Jump to content

nginx + prestashop multistore rewrite


Recommended Posts

Hi,

 

We are using PS 1.5.4.1 on Nginx in Ubuntu Server . We need to enable multistore functionality. We have configured the same. But when we access shop using virtual URL and same as set as 'Main URL', it shows the all pages with out any JS/CSS. 

All the JS/CSS links are changed to domain.com/shopname/xxx.css

And when it is not set as "Main URL" it shows a blank page.

Additionally in Virtual URL block, it shows 'You need to activate URL Rewriting if you want to add a virtual URL.'

Its working perfectly fine in main store but not working with virtual URLs.

 

Do I need to copy all the files in each directory of each Virtual shop?

 

Somebody please help me.

 

Regards

Binu

Edited by binunice (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

I tried in a local environment, and when adding the virtual URL it generates in the htaccess this lines : 

       RewriteCond %{HTTP_HOST} ^domain.com$

       RewriteRule ^test$ /test/ [L,R]
       RewriteCond %{HTTP_HOST} ^domain.com$
       RewriteRule ^test/(.*) / [L]
I used an auto generator (from apache to nginx) :
# nginx configuration location /
{ if ($http_host ~ "^domain.com$"){
rewrite ^/test$ /test/ redirect; }
if ($http_host ~ "^domain.com$"){
rewrite ^/test/(.*) / break; }
}
It loads the page, but it doesn't load some files and the friendly url of the first shop are broken.
Edited by xlynx (see edit history)
Link to comment
Share on other sites

Finally, I got derived at a solution. Here it is

 

Add this portion inside server directive of nginx conf :

 if ($http_host ~ "^domain.com$") {
                    rewrite ^/store1/(.*) /$1 last;
                    rewrite ^/store2/(.*) /$1 last;
                    rewrite ^/store3/(.*) /$1 last;
                    break;
}

Where domain.com is domain name and store1, store2 and store3 are 3 stores.

Link to comment
Share on other sites

×
×
  • Create New...