magento store views under sub folders with nginx

There are a couple of methods to achieve this, it just depends on which is more appropriate.
In our examples,
The domain is
The store view URI is mynewstore
The store code is mynewstore_en
The run type is store
Method 1
If don't mind sharing the entire root directory with the other store (ie. if you don't have a unique blog etc.), then you can do the following.
Create a symlink from the desired URI to the main http dir
cd /microcloud/domains/example/domains/`
ln -s mynewstore .`
Edit the ___general/ file and add this
location ~* ^/mynewstore{
  location ~* .(php) {
    set $my_mage_run_code "mynewstore_en";
    set $my_mage_run_type "store";
    include fastcgi_params;
  try_files $uri $uri/ /mynewstore/index.php$is_args$args;
Method 2
If you need to have unique folders within each installation, you should set up a symbolic link per directory that needs to be shared. Creating (and editing) a new index.php and symbolically links back to the respective directories as necessary.
cd /microcloud/domains/example/domains/
mkdir en
cd en
ls ../ | while read FILE; do
  ln -s ../$FILE .
rm index.php
cp ../index.php .
Then create the rewrite rule, edit the ___general/ file and add this
location /en {try_files $uri $uri/ @en;}
location @en {
  rewrite . /en/index.php$is_args$args last;

Or just symply add
 location /foldername/ {
                try_files $uri $uri/ /foldername/index.php?$args;


0 Bình luận

Trở về
  • HTML5 Canvas
  • HTML5 Canvas

     The <canvas> element is used to draw graphics, on the fly, on a web page. Draw a red rectangle, a gradient rectangle,...