nginX上的OpenCart

OC2*_*2PS 12 .htaccess nginx url-rewriting opencart

OpenCart可以在nginX上使用SEO URL吗?据我所知,在Apache中,它创建了一个.htaccess,但它是否能够自动管理nginX中的URL重定向?

The*_*Kid 20

Nginx上的OpenCart - 我们已经使用它一年了.最后似乎其他人开始使用它.获得帮助是一场噩梦,有时候进入Nginx很棘手.

www.site.com.vhost在下面,例如:

# FORCE WWW
server {
    server_name  site.com;
    rewrite ^(.*) http://www.site.com$1 permanent;
}
# MAIN SERVER
# NINX 0.8.54 - WORKS ON 1.1.19
server {
    server_name  www.site.com;
    listen 80;
    root /var/www/www.site.com/web;
    index index.php index.html;
    location /image/data {
        autoindex on;
    }
    location /admin {
        index index.php;
    }
    location / {
        try_files $uri @opencart;
    }
    location @opencart {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    # Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
    location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
        deny all;
    }
    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
    location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
        expires max;
        log_not_found off;
    }
    location ~ \.php$ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
Run Code Online (Sandbox Code Playgroud)

好的,现在关于管理您的网站.您现在可以通过管理员启用搜索引擎优化,请参阅我的其他帖子标记为nginx和opencart的所有网址,并进一步自定义location / {}

我还建议阅读有关删除index.php?route = - 链接如下:

从OpenCart中删除index.php?route = common/home