ThibautMT Posted April 23, 2020 Share Posted April 23, 2020 Hi, I am using multistore with 2 different domains in my shop. I use both address without www. I have a problem with redirection when the customer uses a link with www. https://domain1.com (main domain) and https://domain2.com are working with no problem WHen customer visits www.domain1.com it redirects to domain1.com - that's good. But when the customer visits www.domain2.com it redirects to domain1.com (main domain) - this is not good and I do not know how to solvve it. I know I need to put some code in .htaccess but the code I have is wrong and causes the redirection error. Can anyone know how to solve this correctly? Link to comment Share on other sites More sharing options...
jetway Posted April 23, 2020 Share Posted April 23, 2020 RewriteEngine on RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC] RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301] This should do the job. It will redirect to https://yourdomain.com Link to comment Share on other sites More sharing options...
ThibautMT Posted April 23, 2020 Author Share Posted April 23, 2020 Thanks for you answer. I already did this RewriteEngine on RewriteCond %{HTTP_HOST} ^www.domain2.com [NC] RewriteRule ^(.*)$ https://domain2.com/$1 [L,R=301] But still redirect www.domain2.com -> (302 moved ) http://domain1.com -> (301) https://domain1.com I've tested a lot of things. I'm desperate Link to comment Share on other sites More sharing options...
jetway Posted April 23, 2020 Share Posted April 23, 2020 did you place it in the .htaccess file of the top directory...right within public_html. I also advice you to put it in the segment that covers your domain2 If RewriteEngine has been turned on at the beginning of the .htaccess you dont need to write that again. Link to comment Share on other sites More sharing options...
ThibautMT Posted April 23, 2020 Author Share Posted April 23, 2020 (edited) Yes i placed it here # ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again # .htaccess automaticaly generated by PrestaShop e-commerce open-source solution # http://www.prestashop.com - http://www.prestashop.com/forums <IfModule mod_rewrite.c> <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE On </IfModule> RewriteEngine on RewriteCond %{HTTP_HOST} ^www.domain2.com [NC] RewriteRule ^(.*)$ https://domain2.com/$1 [L,R=301] I tried to put him too in the #Domain: domaine2.com part. I deleted all the cache from the backoffice, and from /var/cache, but it still doesn't work :/ Edited April 23, 2020 by ThibautMT (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now