求教nginx伪静态!!!加急!!!
linux vps 用的lnmp nginx/0.8.52根目录下装有wordpress
/shop/目录下装有一淘客程序
2个程序都需设置伪静态规则,单独使用规则都没有问题,如果添加wordpress伪静态,子目录下的规则就失效了。
请教如何使2个规则同时有用,即子目录下的伪静态如何设置。
具体配置如下,
----------------wordpress.conf----------------
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; 《-------------------估计这句有冲突,请教如何改?
}
----------------taoke.conf----------------
rewrite (.+)product\.php/(+)\.html$ $1product.php?iid=$2 last;
rewrite (.+)list\.php/(+)-(+)-(+)-(+)-(.+)-(+)\.html$ $1list.php?catid=$2&sortnum=$3&sp=$4&ep=$5&q=$6&page=$7 last;
rewrite (.+)list\.php/(+)-(+)-(+)-(+)-(.+)\.html$ $1list.php?catid=$2&sortnum=$3&sp=$4&ep=$5&q=$6 last;
rewrite (.+)list\.php/(+)-(+)-(+)-(+)-\.html$ $1list.php?catid=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)list\.php/(+)-(+)-(+)-(+)-\.html$ $1list.php?catid=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)list\.php/(+)-(+)-(+)-(+)\.html$ $1list.php?catid=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)list\.php/(+)-(+)\.html$ $1list.php?catid=$2&sortnum=$3 last;
rewrite (.+)list\.php/(+)\.html$ $1list.php?catid=$2 last;
rewrite (.+)shop\.php/(.+)-(+)-(+)-(+)-(+)\.html$ $1/shop.php?user=$2&sortnum=$3&sp=$4&ep=$5&page=$6 last;
rewrite (.+)shop\.php/(.+)-(+)-(+)-(+)\.html$ $1/shop.php?user=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)shop\.php/(.+)-(+)\.html$ $1/shop.php?user=$2&sortnum=$3 last;
rewrite (.+)shop\.php/(.+)\.html$ $1/shop.php?user=$2 last;
域名conf文件,已添加以上2个配置文件。 伪静态中路径错误,参考https://bbs.vpser.net/thread-1977-1-1.html 已经改为如下规则,仍旧无效。再麻烦看看 谢谢
====================taobao.conf======================
location /shop/ {
rewrite (.+)/shop/product\.php/(+)\.html$ $1/shop/product.php?iid=$2 last;
rewrite (.+)/shop/list\.php/(+)-(+)-(+)-(+)-(.+)-(+)\.html$ $1/shop/list.php?catid=$2&sortnum=$3&sp=$4&ep=$5&q=$6&page=$7 last;
rewrite (.+)/shop/list\.php/(+)-(+)-(+)-(+)-(.+)\.html$ $1/shop/list.php?catid=$2&sortnum=$3&sp=$4&ep=$5&q=$6 last;
rewrite (.+)/shop/list\.php/(+)-(+)-(+)-(+)-\.html$ $1/shop/list.php?catid=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)/shop/list\.php/(+)-(+)-(+)-(+)-\.html$ $1/shop/list.php?catid=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)/shop/list\.php/(+)-(+)-(+)-(+)\.html$ $1/shop/list.php?catid=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)/shop/list\.php/(+)-(+)\.html$ $1/shop/list.php?catid=$2&sortnum=$3 last;
rewrite (.+)/shop/list\.php/(+)\.html$ $1/shop/list.php?catid=$2 last;
rewrite (.+)/shop/shop\.php/(.+)-(+)-(+)-(+)-(+)\.html$ $1/shop/shop.php?user=$2&sortnum=$3&sp=$4&ep=$5&page=$6 last;
rewrite (.+)/shop/shop\.php/(.+)-(+)-(+)-(+)\.html$ $1/shop/shop.php?user=$2&sortnum=$3&sp=$4&ep=$5 last;
rewrite (.+)/shop/shop\.php/(.+)-(+)\.html$ $1/shop/shop.php?user=$2&sortnum=$3 last;
rewrite (.+)/shop/shop\.php/(.+)\.html$ $1/shop/shop.php?user=$2 last;
}
回复 3# 的帖子
那可能是你伪静态有问题 我用的都是官方给出的规则,军哥能否帮忙帮忙写一条规则,不甚感激
静态地址http://mvmv.tk/shop/product.php/7349905126.html
动态地址http://mvmv.tk/shop/product.php?iid=7349905126
回复 5# 的帖子
location /shop/ {rewrite ^/shop/product.php/(+)\.html)$ /shop/product.php?iid=$1 last;
}
页:
[1]