Jump to content

redirect non-www url to www failed


Recommended Posts

Hi there,

I have set up multi-store in Prestashop 1.6.0.6 and it works fine except for one detail, let me explain:

I have shop 1:
http://www.shop1.com

Shop 2:
http://www.shop2.com

If you go to http://shop1.com, it redirected to www.shop1.com (no issue) and if go to http://www.shop2.com then everything works ok. However if you go to http://shop2.com (without www) then you get redirected to http://www.shop1.com

That's obviously a big problem as it is likely some visitors will omit the www.
 

I parked the domain shop2.com on top of shop1.com using "Park domain" feature and shop1 is under root.

 

My .htaccess file is this

 

<IfModule mod_rewrite.c>
< IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
< /IfModule>

 

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.shop1.com$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

 

I have tried the below solution suggested by someone in one of the thread but it didn't work out and give 404 error on other pages, home page is fine.

 

" try this: add this to the top of your .htaccess file..ensures www

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

</IfModule>      

 

"

Does anyone able to help solve my problem? Very much appreciated your help. I have been spending hours to work this out but without luck. I am not technical guys :(

Thanks in advance :)  

Link to comment
Share on other sites

×
×
  • Create New...