mowax Posted April 21, 2013 Share Posted April 21, 2013 Hi all I need to move my prestashop installation to a new domain, and forward all the pages from the old domain to the new one. Could anyone show me how to do the redirects in the .htaccess file that is going in the root of the old domain? Should it be 1 redirect per page, for example: Redirect 301 /page1 http://newdomain.com/page1 Redirect 301 /page2 http://newdomain.com/page2 Redirect 301 /page3 http://newdomain.com/page3 or can you do it with regular-expressions pattern-matching, for example: RedirectMatch 301 ^/([^.]+)\.htm$ http://newdomain.com/$1.htm I read somewhere that this is the best method if the site structure will stay the same. And does the file need to contain anything else or just the redirects? Any help would be appreciated Thanks! Link to comment Share on other sites More sharing options...
Usman Ahmed Posted April 21, 2013 Share Posted April 21, 2013 (edited) Just add following line to .htaccess file: Redirect permanent / http://newdomain.com/ This single line will redirect whole site to new domain. Edited April 21, 2013 by Usman Ahmed (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 21, 2013 Share Posted April 21, 2013 Just add following line to .htaccess file: Redirect permanent / http://newdomain.com/ This single line will redirect whole site to new domain. but this will not redirect to the product pages etc. Am I right? all pages from old domain will be redirected to the newdomain.com - which is homepage right? Link to comment Share on other sites More sharing options...
mowax Posted April 21, 2013 Author Share Posted April 21, 2013 Yes, that would just redirect every old page to the homepage of the new site. Google recommends that each page is redirected individually to its counterpart on the new domain, one redirect for each page. I was just asking if anyone has successfully used regular-expressions pattern-matching, which is a simpler and nicer solution to 100+ redirects. Link to comment Share on other sites More sharing options...
vekia Posted April 21, 2013 Share Posted April 21, 2013 i suggest to use this: Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] this will redirect olddomain.com/somepage.html to newdomain.com/somepage.html it's better for seo Link to comment Share on other sites More sharing options...
Usman Ahmed Posted April 21, 2013 Share Posted April 21, 2013 no, it will redirect all the pages, sub-directories to new domain. The line that I have mentioned will redirect all the pages. Don't forget to add trailing / at the and of the new domain. Redirect permanent / http://newdomain.com/ It will redirect like follows: olddomain.com/category1/product1.html newdomain.com/category1/product1.html Link to comment Share on other sites More sharing options...
vekia Posted April 21, 2013 Share Posted April 21, 2013 Thanks vekia, that sounds good. I'll do some tests and see how I get on. I have another problem which is a bit harder to explain, especially if not familiar with wordpress. I currently have a wordpress multisite installation in the root of the new domain, and lots of network sites on separate domains that run of that wordpress installation. The wordpress files have to be in the root of my new domain for the other websites to work (because my new domain is the primary domain on my hosting account), but I don't want the wordpress installation to be visible in the new domain, just prestashop. So I am thinking that I can just install prestashop in the root of the new domain, where all the wordpress files are hosted, and replace the wordpress index file with the prestashop index file, so that prestashop will load instead of wordpress. Does that sound like a good idea? Edit: Ok thanks Usman, I will try this as well. i splitted topic, this is new question not related to main case in this thread. Link to comment Share on other sites More sharing options...
mowax Posted April 24, 2013 Author Share Posted April 24, 2013 Ok, i created an addon domain to do a test, i tried both of your suggestions, and Usman's line worked. Vekia somehow yours did not, it returned 404 page not founds. Currently I'm using Options +FollowSymlinks RewriteEngine on Redirect permanent / http://www.newdomain.com/ Is this a 301 redirect? I heard that is the best for seo Link to comment Share on other sites More sharing options...
vekia Posted April 24, 2013 Share Posted April 24, 2013 Ok, i created an addon domain to do a test, i tried both of your suggestions, and Usman's line worked. Vekia somehow yours did not, it returned 404 page not founds. Currently I'm using Options +FollowSymlinks RewriteEngine on Redirect permanent / http://www.newdomain.com/ Is this a 301 redirect? I heard that is the best for seo nope, i isn't 301 redirect. here is 301: http://www.prestashop.com/forums/index.php?/topic/241424-moving-prestashop-to-a-new-domain/page__view__findpost__p__1193914 Link to comment Share on other sites More sharing options...
mowax Posted April 25, 2013 Author Share Posted April 25, 2013 According to squidoo.com, the lines you posted are only for canonical redirection (domain.com -> www.domain.com). This is what they suggest for redirecting pages from an old domain to their counterparts on a new domain: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.domain.com/$1 [R=301,L] Seems to work perfectly Got the info here: http://www.squidoo.com/301 Link to comment Share on other sites More sharing options...
vekia Posted April 25, 2013 Share Posted April 25, 2013 Hello thanks for information I can go ahead and mark this thread as solved regards Link to comment Share on other sites More sharing options...
Recommended Posts