Jump to content

[SOLVED] Redirects: Multistore moved to new domains and new host


Recommended Posts

I have searched and searched and not found a solution for this problem I am facing with a customer's shop, so I hope someone can point me in the right direction.


The shop runs multistore (3 domains) and was upgraded from to The old shops are still with the old host on the old domains and they are deactivated, as they will obviously not be needed anymore other than for redirects for a while, until the search engines have re-indexed the pages.


I am looking for a solution that will secure link juice from the old domains, ie. redirects to the new domains including all product pages, CMS pages etc.


What I have tried so far:

The php solution from this thread - post #7: https://www.prestashop.com/forums/topic/387556-editing-htaccess-for-301-redirects-to-new-site-urls/ which does not work - nothing happens when I do this (I just end up in the old shop on the old domain)


To partly fix it right now I have made a rewrite in the .htaccess in the root folder of the old host/domain that redirects the main domain (and sub pages) to the new domain with the same extension. This works for all .dk pages including subpages etc. but the other two domain extensions are both redirected as well (to the homepage only - so all product pages etc. are not working). This means if a customer visists from Sweden, they end up in the new store (.dk) and they cannot see the Swedish version of the shop.


The old store has .dk - .se and .eu domains. The new store has .dk, .se and .com (com replaces .eu from the old store)


I could use the 301-redirect module mentioned in the forum thread - this works well in other shops where I use it, but as far as I can figure out, this demands that I make a 1-to-1 link for each page I wish to redirect and upload this in a .csv file. This means I need to find/map and make redirects manually for all links in the 3 old shops (which is a lot of manuel work) and I am not even sure if this works for the main domains at all - or if the module only works with product pages, cms pages and so on.

Example oldshop1.dk, oldshop2.eu, oldshop3.se should point to newshop1.dk, newshop2.com and newshop3.se - and then there are still all product pages and whatever is indexed in the search engines.


Basically what I am looking for is a solution as to what I need to put in the .htaccess file that is in the root of the old shop in order to redirect the 3 old domains from the old host to the 3 new domains with the new host - and keep all links working as these are the same in the new shop (other than the domain itself).


I hope someone has some ideas:-)

Edited by Prestafan1234 (see edit history)

Share this post

Link to post
Share on other sites

first of all please clarify:

old host  and old presta has: domain A , Domain B, domain C

new host and new presta has domain D , domain E, domain F


u want to redirect domains A to D, B to E and C to F


Share this post

Link to post
Share on other sites

Hi thanks for your time, I don't want all domains to redirect to just one domain (that is easy to do and that is what happens at the moment due to my .htaccess redirect)


I'll try to clarify


Old host:

xxxold.dk - this was the main store on the old host




New host:





I need this to happen

xxxold.dk ---> xxxnew.dk

yyyold.se --> yyynew.se

zzzold.eu --> zzznew.com - this is the main store on the new host

Share this post

Link to post
Share on other sites

insert this code somewhere before line   # ~~start~~ Do not......

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?xxxold\.dk [NC]
RewriteRule (.*) http://xxxnew.dk/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?xxxold\.se [NC]
RewriteRule (.*) http://xxxnew.se/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?xxxold\.eu [NC]
RewriteRule (.*) http://xxxnew.com/$1 [R=301,L]

in the  htaccess file in prestashop folder on your old host

  • Like 1

Share this post

Link to post
Share on other sites

Getting closer:-)


It works for .se and .com - but not for .dk that just stays on the old site


EDIT: My bad! had accidently deleted the ? before the .dk domain. It seems everything is working now! I am sure others must have struggled with this too


Thanks a lot for your help!

Edited by Prestafan1234 (see edit history)

Share this post

Link to post
Share on other sites

  • 2 weeks later...

Hi "hatak"

Can you please help me with this problem?


I was adviced to move the ID numbers of the Category pages and Product Pages to the end.

So instead of:

Category root: {id}-{rewrite}

i have: {rewrite}-{id}


And for product pages instead of:


i have: {category:/}{rewrite}{-:ean13}-{id}.html


I need a line of code (becasue i see that you know how to wirte htaccess codes) in order to 301 from all links to new ONE's that have ID in the end.

I hope that there is an one line code solution, it don't want to do it manually for all pages :(


Thank you!

Edited by Leo Ce (see edit history)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More