Jump to content
vkmaxx

2nd store redirects to main store, multistore redirection problem

Recommended Posts

Hello,

I have problem with configuring multistore in prestashop. My main store is www.prezentyhurt.pl, my second store is www.zakazaneprezenty.pl.

If I try to open 2nd store directly it redirects me to first store:

www.zakazaneprezenty.pl opens www.prezentyhurt.pl/pl/

But if I open it by adding something to url it open correctly:

www.zakazaneprezenty.pl/pl/ opens correct page and I can browse website.

Edited by vkmaxx (see edit history)

Share this post


Link to post
Share on other sites

OK, I solved it. The problems was that entering web page without www was not lunching multistore script, the solution was to add:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

just after

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

RewriteEngine on

More information about this problem

 

 

Edited by vkmaxx (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites
On 11/16/2017 at 3:23 PM, vkmaxx said:

OK, I solved it. The problems was that entering web page without www was not lunching multistore script, the solution was to add:


RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

just after


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

RewriteEngine on

More information about this problem

Thh

 

 

 

This is great fix, I had same issue when writing my own multishop module so I fixed within module to match url 'without' www.  That  way back in PS 1.4 and still there for 1.6.  I will try to open forge report on how we solved in module as this causes a lot of issues for shop managers...thanks for posting you fix for others.

Share this post


Link to post
Share on other sites
7 hours ago, El Patron said:

 

poster solved, your post has value as what?  Please read posts before posting your guess, it's not about quantity of posts it about quality.

 

i just post following my experience,of course i didn't read the first answer,

but what i write is right,     domain.comx and www.domain.comx  is different,it's shop url problems,

Share this post


Link to post
Share on other sites

Hi, I have similar problem and this solution doesn't work for me. It was working by default on PS1.5 but it stopped working after upgrading to PS1.6(.1.18). Let me explain.

I have a multistore with 2 domains which purpose is to differentiate the experience for customers from 2 countries, so we can use different banners, and graphics for one country and other for the second.

We have a main shop on www.domain1.com and the second on www.domain2.com. When we were still on PS1.5 we bought a SSL certificate, but only for domain1, so we changed the behavior so, that www.domain2.com sends customers to a virtual URL www.domain.1.com/lang2. This all worked fine in PS1.5.

Now in PS1.6 when customer goes to www.domain2.com he is sent incorrectly to the shop1 default www.domain1.com without the virtual /lang2 extension. If I go to www.domain1.com/lang2 directly, it works, but not from domain2.com. It doesn't work with nor without www in front of the domain.

If I change the default URL of shop2 back to www.domain2.com, it correctly stays there with the browser warning about that domain not being secured, which is ok, since that domain doesn't have SSL cert.
 

I tried adding the lines to .htaccess, tried adding new shop url to shop2 to cover www and nonwww URLs

Funny thing is, I have also a backup test shop (same PS version) on test.domain1.com and this shop works correctly sending customers from test.domain2.com to test.domain1.com/lang2 . All the settings are the same :( except the www and test subdomain.

The configuration is like this:

  • All shops
    • Warehouse
      • Shop1
        • www.domain1.com (default)
      • Shop2
        • www.domain2.com
        • www.domain1.com/lang2 (default)
        • domain2.com

 

I even tried adding a domain3.com to Shop1 and making it default for Shop1, and then going to www.domain2.com (Shop2) sent me to www.domain3.com (Shop1), which is wrong shop. I don't know if I'm missing something here, maybe a setting in completely different part of PS configuration that wasn't there in PS1.5 and is there now, but I'm truly at the end of my options :(

Edited by Dest
correction (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites
On 16/11/2017 at 10:23 PM, vkmaxx said:

OK, I solved it. The problems was that entering web page without www was not lunching multistore script, the solution was to add:


RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

just after


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

RewriteEngine on

More information about this problem

 

 

 

I verify this solution.

 

Annoying problem, easy fix. Thank you so much!

  • Like 1

Share this post


Link to post
Share on other sites
On 11/17/2017 at 8:23 AM, vkmaxx said:

OK, I solved it. The problems was that entering web page without www was not lunching multistore script, the solution was to add:


RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

just after


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

RewriteEngine on

More information about this problem

 

 

This works great but the issue i face is my primary store is on a sub domain (i.e shop.domain.com.au) and when i do this my primary domains dns doesnt resolve because it tried to go to www.shop.domain.com.au

Share this post


Link to post
Share on other sites
Posted (edited)
On 11/16/2017 at 10:23 PM, vkmaxx said:

OK, I solved it. The problems was that entering web page without www was not lunching multistore script, the solution was to add:


RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

just after


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

RewriteEngine on

More information about this problem

 

 

Hi

 

I have added this text as shown to the htaccess file

Still have the problem

first shop works both www and non www used (example - petersmith com and www.petersmith com) 

Second shop only works when the same url name is written in the multishop url

See enclosed photo

so on this example the second shop has (http://www.alej.......com) 

but non www does not work (http://aleja........com

should i post the htaccess file ??

 

what i would like to get working is both www and non www to work 

site 1 -

www.aurak.....com

aurak....com 

 

site 2

www.aleja.....com

aleja...com

 

I also have one htaccess and one htaccess_bk file

which one to edit?

 

www redirect.JPG

Edited by ilegales (see edit history)

Share this post


Link to post
Share on other sites

Hello guys,

I tried vkmaxx solution but It didn't work for me.

I solved adding:

#First condition, If is HTTPS without wwww, redirects to www.
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
 
#Second condition, If is not HTTPS and without www, redirects to HTTPS with WWW.
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*) https://www.%{SERVER_NAME}/$1 [R,L]
 
#Third, If is not HTTPS and have www, redirects only to HTTPS
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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