Friday, May 18, 2012

nginx rewrite rule for opencart

It took me a while to find out the solution, yet at last, I found it is pretty easy, the admin folder just need to take a bit extra care. This rewrite rule works moreover work with SEO url settings enabled.

Tested with opencart 1.5.13

   location / {        if ($host != 'www.example.com') {                rewrite ^/(.*)$ http://www.example.com/$1 permanent;        }        try_files $uri @opencart;    }    location @opencart {        rewrite ^/(.+)$ /index.php?_route_=$1 last;    }        location /admin/ {        index index.php;        }    location ~* (\.(tpl|ini))$ {          deny all;    }

No comments:

Post a Comment