Hey there, I am very stuck at the following problem. My e-commerce site is in Magento. It used to have only one store view i.e. language. Now I want to add a second language. In Magento, you can add a store code to the URL, to make a distinction between the languages. So where the URL for a specific product used to be like this: www.myshop.com/myproduct.html it will now become www.myshop.com/en/myproduct.html with 'en' being the english store view. For Google this means trouble, because as soon as I put these modifications live, Google won't be able to find all currently indexed pages anymore. So what I am looking for is mod rewrite voodoo that does the following: reroute all traffic that comes in with no store code (like 'en') to the 'en' store code do not reroute anything that already has a store code do the rerouting as 'permanent' so Google will know it has to change the old URL's to the new ones In this article http://www.magentocommerce.com/boards/viewthread/22677/ this is explained. Somebody suggests the following voodoo: *** start voodoo snippet ***** ## redirect do Deutsch if there's no preference in the URL RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_URI} !(index.php|de/|fr/|uhu_fr/|k55_de/|k55_en/) #add your own store-views here RewriteRule ^(.*)$ de/$1 [R,L] #add your preferred default-store view here *** end voodoo snippet ***** Looks as good voodoo to me, but unfortunately, it leads to a server error (500). It is beyond me why, but I am hoping that somebody out here can point me in the right direction! Thanks very much in advance!! Haraldinho
www.myshop.com/myproduct.html how many default pages? are they all in current folder and end in html? I see it as simple as this RewriteRule ^(.*?).html$ /en/$1.html [L, R=301]
Hi scriptinstaller, It isn't as easy as that I'm afraid. Magento uses all kind of mechanisms. Not only .html files but also directories. Not everything is in the current folder. Haraldinho
I finally figured out why I got the server error. I had not set the RewriteBase. That wasn't necessary before, but it is now, with these new commands. The code snippet below shows the rewrite part of my .htaccess file: <IfModule mod_rewrite.c> ############################################ ## enable rewrites Options +FollowSymLinks RewriteEngine on ############################################ ## you can put here your magento root folder ## path relative to web root RewriteBase /magento/ ############################################ ## workaround for HTTP authorization ## in CGI environment RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] ############################################ ## the following is used for rewriting old ## URL's without a store code in it to the ## new URL format with store codes # If the request does not match an existing file RewriteCond %{REQUEST_FILENAME} !-f # and the request does not match an existing directory RewriteCond %{REQUEST_FILENAME} !-d # and the request does not match a symbolic link RewriteCond %{REQUEST_FILENAME} !-l # and the request URL does not already contain an existing store code RewriteCond %{REQUEST_URI} !(index.php|nl/|en/) #rewrite to the default store view RewriteRule ^(.*)$ nl/$1 [R=301,L] ############################################ ## always send 404 on missing files in these folders RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ ############################################ ## never rewrite for existing files, directories and links # If the request does not match an existing file RewriteCond %{REQUEST_FILENAME} !-f # and the request does not match an existing directory RewriteCond %{REQUEST_FILENAME} !-d # and the request does not match a symbolic link RewriteCond %{REQUEST_FILENAME} !-l ############################################ ## rewrite everything else to index.php RewriteRule .* index.php [L] </IfModule> Code (markup): Thanks for the help! Haraldinho