1

I have a multi-store setup with the german domain running on .de and the english on .com.

Now I need to move them both together to the .com domain utilizing the store codes in the urls.

www.example.de -> www.example.com/de/
www.example.com -> www.example.com/en/

The magento setup itself runs fine. What I have issues with is to redirect the existing urls (from google) to their new location:

www.example.de/category.html -> www.example.com/de/category.html
www.example.com/category.html -> www.example.com/en/category.html

So I setup a simple test site (not magento) only to create the proper htaccess rewrite rules. This is what I figured out and it works as expected:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www.example.de$ [NC]
RewriteCond %{REQUEST_URI} !de/
RewriteRule (.*) /de/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteCond %{REQUEST_URI} !en/
RewriteRule (.*) /en/$1 [R=301,L]

When I put this into my magento .htaccess things get weird though.

Of course there are more magento specific rewrites in there. The complete list of rules are these:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www.example.de.dev$ [NC]
RewriteCond %{REQUEST_URI} !de/
RewriteRule (.*) /de/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www.example.com.dev$ [NC]
RewriteCond %{REQUEST_URI} !en/
RewriteRule (.*) /en/$1 [R=301,L]

RewriteRule ^api/rest api.php?type=rest [QSA,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* /index.php [L]

Those extra rules are all from a default magento installation.

When I access https://www.example.com I end up at https://www.example.com/en/index.php with a browser error (endless redirect).

How to get this right?

Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.