MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Tips and Tricks => Topic started by: djscooby on 2013-06-01, 03:54:30

Title: Kloxo MR - Nginx Rewrite Rules for Opencart
Post by: djscooby on 2013-06-01, 03:54:30
Hi guys

After some searching i finaly find some rules for nginx and opencart.
These rules support SEO urls also..

So if anyone needs to setup opencart e-commerce with nginx on kloxo here's the rules that needs to apply :

1. Inside /home/nginx/conf/globals create file opencart.conf with contents :
Code: [Select]
location ~/admin {
       index index.php;
    }
location ~/image/data {
        autoindex on;
   }
location ~/ {
       try_files $uri @opencart;      
    }
location @opencart {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }

2. Inside /home/nginx/conf/domains find the .conf file of your domain and edit it
in line 33+77 (*before the closing })  add :
Code: [Select]
include '/home/nginx/conf/globals/opencart.conf';

3. Save the file and then from SSH run
Code: [Select]
service nginx restart
4. Remeber that if you change webservers or run "fixweb" then u need to reapply step 2.


PS: It is possible to apply this as a template inside .tpl nginx files, but i can't remember how to. If anyone knows please share.
Title: Re: Kloxo MR - Nginx Rewrite Rules for Opencart
Post by: MRatWork on 2013-06-01, 04:21:57
Don't use domains.conf.tpl but copy domains.conf.tpl to custom.domains.conf.tpl and then modified custom.domains.conf.tpl and then run 'sh /script/fixweb; sh /script/restart-all'.