Enable SEO URLs on multi stores and subdomains on OpenCart using Nginx Enable SEO URLs on multi stores and subdomains on OpenCart using Nginx nginx nginx

Enable SEO URLs on multi stores and subdomains on OpenCart using Nginx


I got this article and details from someone, in my company SEO and marketing team are using this tool..

From Setup SEO Full Friendly URLs on nginx on the XenForo forums:

It's actually really really simple.

Considering you have uploaded XenForo into the directory "community", just add this to your nginx config:

location /community/ {            index  index.php index.html index.htm;            try_files  $uri $uri/ /community/index.php?$uri&$args;        }

While you are at it you might also want to add this to block external access to the folders "internal_data" and "library".

location ~ ^/community/(internal_data|library)/(.*)$ {            internal;        }

Restart nginx and enable Full Friendly URLs.

From Straight Forward Easy Instructions for Multi-Store Setup? on the Opencart forums:

The short version is:
create 2 demo sub domains
subA.domain.com
subB.domain.com
and "point" both sub domains to the same folder on your web host.
i.e. public_html/shop
Install opencart to the first sub domain and then go through the admin and add an extra store.

So you'll have Shop1 subA.domain.com and Shop2 subB.domain.com both running the same code.

Hope that makes sense.


OpenCart does not handle SEO URLs for multi-stores. The only way to do this - manually add the URLs within the location {} of the m.shop.vhost

This will work (example)

www.shop.com.vhostwww.shop.com/index.php?route=checkout/cartwww.shop.com/checkout/cartrewrite ^/checkout/cart?$ /index.php?route=checkout/cart last;

And this will not work:

m.shop.com/checkout/cart - it will return 404.

This will make it work

m.shop.com.vhost    location / {    rewrite ^/checkout/cart?$ /index.php?route=checkout/cart last;}

You just have to manually add all the SEO URLs you want. A global smart re-write would be needed for product links since of course you can't manually add them. If I may suggest something - if this is a mobile site - then you dont need SEO URLs really.. users hardly use them for phones, sure the savy user would appreciate friendly SEO links but using the PHP string and parameter and queries might be better to use on phone - the only downside is it requires advanced redirection.

My guess is you want this to work so that you can automatically just change the header from www to m and m to www for phone so easier redirection class.. if that is the case than I would like to hear from someone else who has this done. We use NGINX on 2 load balanced servers and use Magento, OpenCart and another script for our company stores. We like you are one of the serious companies doing high volume transactions on OpenCart - we have a dedicated team handling the international orders and language queries inside it..