Nginx doesn't use .htaccess so rewrite rules must apparently be placed into the server block file, eg. /etc/nginx/sites-available/domain.com
I found a few configs thru google but none of them seem to make a difference, I always end up with a 404 when I click on a product when SEO URLs are enabled.
For example, one of the configurations I've tried is https://stackoverflow.com/questions/156 ... t-on-nginx
I can't seem to find anything within the past year so maybe the information is outdated for OpenCart 2.X?
I would appreciate any help or being pointed in the right direction with this.
This worked 
It didn't at first because I had a duplicate location / { from before.
sudo nginx -t is helpful

Code: Select all
# SEO URL Settings
# Nginx configuration of OC htaccess
location = /sitemap.xml {
rewrite ^(.*)$ /index.php?route=feed/google_sitemap break;
}
location = /googlebase.xml {
rewrite ^(.*)$ /index.php?route=feed/google_base break;
}
location / {
# This try_files directive is used to enable SEO-friendly URLs for OpenCart
try_files $uri $uri/ @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
# End SEO settings
sudo nginx -t is helpful

danger wrote: ↑Fri May 06, 2016 7:17 amThis worked
It didn't at first because I had a duplicate location / { from before.Code: Select all
# SEO URL Settings # Nginx configuration of OC htaccess location = /sitemap.xml { rewrite ^(.*)$ /index.php?route=feed/google_sitemap break; } location = /googlebase.xml { rewrite ^(.*)$ /index.php?route=feed/google_base break; } location / { # This try_files directive is used to enable SEO-friendly URLs for OpenCart try_files $uri $uri/ @opencart; } location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; } # End SEO settings
sudo nginx -t is helpful![]()
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Who is online
Users browsing this forum: No registered users and 108 guests