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 != '') { rewrite ^/(.)$$1 permanent; } try_files $uri @opencart; } location @opencart { rewrite ^/(.+)$ /index.php?route=$1 last; } location /admin/ { index index.php; } location ~ (.(tpl|ini))$ { deny all; }