- 积分
- 2
- 威望
-
- 金钱
-
- 注册时间
- 2010-9-5
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
我现在在/usr/local/nginx/conf/里面建立了一个cs-cart.conf的文件,内容是
location ~ /\.ht {
deny all;
}
location / {
root /home/wwwroot;
index index.php;
try_files $uri $uri/ /index.php?sef_rewrite=1;
}
location ~ /catalog {
try_files $uri/index.html /index.php?sef_rewrite=1;
}
接着.htaccess文件内容是
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite ^ /index.php?sef_rewrite=1;
}
结果在后台设置的时候不行,提示是
SEO-friendly URLs are disabled. Check your web server and URL manipulation engine settings.
参考http://www.ekuzo.com/cs-cart-nginx-fastcgi-seo-urls-rewrite-699
server {
listen 80;
server_name ekuzo.com www.ekuzo.com;location / {
root /var/www/html/ekuzo;
index index.php index.html index.htm;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite ^ /index.php?sef_rewrite=1;
}
}
location ~ .php$ {
root /var/www/html/ekuzo;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~ /.ht {
deny all;
}
}
其中下面的一段是URL的重写规则:
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite ^ /index.php?sef_rewrite=1;
} 还有CS-CART这个http://forum.cs-cart.com/showthread.php?t=13726&highlight=nginx
# Deny acces to .htaccess files in case i forget to remove them.
location ~ /\.ht {
deny all;
}
# Main location to serve static files.
location / {
root /srv/http/mir-shin/htdocs;
index index.php;
# First rewrite rule: this rule tries to access file of the request,
# if failed - directory, and if that also fails - rewrites request to php.
try_files $uri $uri/ /index.php?sef_rewrite=1;
}
# Location for static catalog, which i don't use, but decided to leave
# it in my config in case I'll decide to actually use static catalog.
location ~ /catalog {
try_files $uri/index.html /index.php?sef_rewrite=1;
}
.htaccess文件内容
f (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite ^ /index.php?sef_rewrite=1;
都不成功。并且有重启nginx服务还是不成功。请求各位高手给予帮助 |
|