kmorgen Posted October 26, 2013 Share Posted October 26, 2013 I have moved our PS 1.5.6 shop from shop.domain.com to www.domain.com and it works fine. However I obviously also want to redirect all the traffic from the old subdomain to the new one. All urls are still the same, so how should I do this in .htaccess? I also have a lot of old urls from the previous master website I now want to 301 redirect to the new site. How should the structure be for these, and will it actually work if placed outside start/end in .htaccess (ca read that many cannot get 301 redirects to work with PS in .htacess) Link to comment Share on other sites More sharing options...
vekia Posted October 26, 2013 Share Posted October 26, 2013 you have to create 301 redirection in ,htaccess file, something like this: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] Link to comment Share on other sites More sharing options...
Rolige Posted October 26, 2013 Share Posted October 26, 2013 (edited) Or you can do this from BO > Preferences > SEO & URLs > go to shop domain and add the prefix www. Edited October 26, 2013 by COTOKO (see edit history) Link to comment Share on other sites More sharing options...
kmorgen Posted October 27, 2013 Author Share Posted October 27, 2013 you have to create 301 redirection in ,htaccess file, something like this: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] Is this for moving the old shop.domain.com/url trafic to the new www.domain/url? The 'RewriteEngine on' is already defined in the PS generated code. Should I still add this outside the End code? How about the other 301 redirects I also need to make? Link to comment Share on other sites More sharing options...
vekia Posted October 27, 2013 Share Posted October 27, 2013 yes it is, but the question is: you changed only domain, and new one point to the same server? Link to comment Share on other sites More sharing options...
kmorgen Posted October 28, 2013 Author Share Posted October 28, 2013 Yes, just moved the shop from shop. to www. - so need to make old sure the old urls are redirected. However before I had another CMS on www., which is now replaced then. So also need to manuel redirect all these urls to a new location on the shop. Link to comment Share on other sites More sharing options...
Rolige Posted October 28, 2013 Share Posted October 28, 2013 If you have cpanel you can configure the redirect very easy, just find for redirect domain Link to comment Share on other sites More sharing options...
kmorgen Posted October 29, 2013 Author Share Posted October 29, 2013 (edited) I just can't get any of this to work :-( old url: http://shop.chill-innovation.com new url: www.chill-innovation.com All urls are the same, so traffic should just be directed to the new location. As suggested I tried to add this code with no result: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.chill-innovation.com/$1 [R=301,L] Also tried this with no result: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^shop.chill-innovation.com$ [NC] RewriteRule ^(.*)$ http://www.chill-innovation.com/$1 [L,R=301] For all the manual 301 Redirects, I tried to do these in cPanel, but did not work either. They are auto added like this: RewriteCond %{HTTP_HOST} ^chill\-innovation\.com$ [OR]RewriteCond %{HTTP_HOST} ^www\.chill\-innovation\.com$RewriteRule ^faq\.php$ "http\:\/\/www\.chill\-innovation\.com\/en\/content\/9\-faq" [R=301,L] Instead, I then manually added them to .htaccess like this, which seem to work: Redirect 301 /faq.php http://www.chill-innovation.com/en/content/9-faq However also have some urls with added code after .php, which do not seem to work in this format: Redirect 301 /products/products.php?kategori=22&products=45 http://www.chill-innovation.com/en/20-bluetooth-keyboards Edited October 29, 2013 by kmorgen (see edit history) Link to comment Share on other sites More sharing options...
Rolige Posted October 30, 2013 Share Posted October 30, 2013 Ive tested righ now and was redirected correctly. Link to comment Share on other sites More sharing options...
kmorgen Posted November 1, 2013 Author Share Posted November 1, 2013 Well, to make the old shop.domain.com/url redirect to the new www.domain.com/url location, I ended up creating Shop as subdomain in cPanel and redirected it with Wildcard ticked to the new location. This finally seemed to work. However still did not figure out how to redirect the hundreds of url's with a Query String :-( For example, the old: http://www.chill-innovation.com/products/products.php?kategori=22&products=45 needs to be redirected to http://www.chill-innovation.com/en/20-bluetooth-keyboards Link to comment Share on other sites More sharing options...
Rolige Posted November 2, 2013 Share Posted November 2, 2013 Well, to make the old shop.domain.com/url redirect to the new www.domain.com/url location, I ended up creating Shop as subdomain in cPanel and redirected it with Wildcard ticked to the new location. This finally seemed to work. However still did not figure out how to redirect the hundreds of url's with a Query String :-( For example, the old: http://www.chill-innovation.com/products/products.php?kategori=22&products=45 needs to be redirected to http://www.chill-innovation.com/en/20-bluetooth-keyboards You can do this easily on .htaccess, for example: Redirect 301 /products/products.php?kategori=22&products=45 http://www.chill-innovation.com/en/20-bluetooth-keyboards If you want redirect using match, here more examples: https://my.bluehost.com/cgi/help/htaccess_redirect regards. Link to comment Share on other sites More sharing options...
kmorgen Posted November 3, 2013 Author Share Posted November 3, 2013 You can do this easily on .htaccess, for example: Redirect 301 /products/products.php?kategori=22&products=45 http://www.chill-innovation.com/en/20-bluetooth-keyboards If you want redirect using match, here more examples: https://my.bluehost.com/cgi/help/htaccess_redirect regards. Yeah, I did this for all the regular URLs, but does not seem to work with all the ones with Query String :-( Link to comment Share on other sites More sharing options...
kmorgen Posted November 3, 2013 Author Share Posted November 3, 2013 I am getting crazy with Prestashop!!!!!! If I then add this in top, before START in .htaccess: Rewriteengine on RewriteCond %{HTTP_HOST} ^www.chill-innovation.com$ RewriteCond %{QUERY_STRING} ^kategori=22&products=45$ [NC] RewriteRule ^products/products\.php/$ /en/20-bluetooth-keyboards? [R=301,NE,NC,L] I can get it to work if I add www. in the url in the browser, but will end at 404 if I do not add www. If I instead add it below END, then it will not work at all. So the Prestashop generated .htaccess code is screwing something up :-( Link to comment Share on other sites More sharing options...
Rolige Posted November 6, 2013 Share Posted November 6, 2013 Maybe you have something wrong in the htaccess, try this. - Firstly configure your URLs, disable friendly URL and save - Configure your URL domain, if you want to use www then set it in both input (for SSL and non SSL) and save. - Now enable again the friendly URL and save. - At this moment you have created the .htaccess file automatically -Now edit this new .htaccess file in your root path of your shop and try adding these lines that I said before in the bottom of the file. Test and tell me if works Link to comment Share on other sites More sharing options...
kmorgen Posted November 29, 2013 Author Share Posted November 29, 2013 I ended up using the code format from this redirect generator, which are working:http://seo-website-designer.com/HtAccess-301-Redirect-Generator#heading-ToolResult The regular 'Redirect 301' command does not support query strings, so had to make them like the generator does. The only way I could get the subdomain (shop.xxx.com/?) to redirect to the new root doamin (www.xxx.com/?) was to actually create the sub domain in cPanel, and then redirect it from here. Now it seems to work. Link to comment Share on other sites More sharing options...
Recommended Posts