Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

What rewrite rule will redirect all links from a subdirectory to the same on a subdomain? In Magento
Jr. Member
Total Posts:  6
Joined:  2011-09-19

I’m having redirection issues with changing my Magento multi-site of 5 stores over to a subdomain from a subdirectory. I’ve got the store working on the subdomain at but all indexed pages in Google that were previously on the subdirectory URL (at of the same store are now just redirecting to the root subdomain at it’s base (with no link to the actual product or category url).

My .htaccess file is in the root directory outside of Magento and all stores. An overview looks like:

Home page - (where htaccess is)

Store 1 -
Store 2 -
Store 3 -
Store 4 -

Store 5 - (where store 5 has been moved to)
So all currently indexed links go to only. They do not go to their relevant long URL as indexed.

I have tried a Rewrite rule in both the root htaccess and inside the old directory for Store5 at /commercial/store5 but neither work.

This is what I have in the old sub directory:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$$1 [R=301,L]

Is there something I am missing here? I can’t figure out whether it’s a Magento issue or merely wrong syntax or placement of the rewriterule.

I’ve also tried adding a rewrite rule inside of the admin and it doesn’t have an effect.

Any help would be greatly appreciated.

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top