opencart nginx rewrite rules problem

To get working seo urls in opencart powered by nginx you need to put some special rules in your website conf in nginx directory.

First , we need go put this files in our conf:

location / {
try_files $uri @opencart;
}

location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}


Now we have working seo urls 🙂

Ok, but I found problem, with this settings my /admin directory now is not working and the web server says : Not found 404

To fix this we need to put :

location /admin
index index.php;
}

before up rule and the config will looks like this:
location /admin {
index index.php;
}
location / {
try_files $uri @opencart;
}

location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}


That’s it 🙂