编程

OPENCART 3.0 Nginx 伪静态规则

1084 2023-09-17 23:56:00

 

# SEO URL Settings
  # Nginx configuration of OC htaccess
  
  location  /brands {
       if (!-e $request_filename) {
           rewrite ^/brands /index.php?route=product/manufacturer;
       }
  }
  location  /contact-us {
        if (!-e $request_filename) {
            rewrite ^/contact-us /index.php?route=information/contact;
        }
  }
                
                
  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