Board logo

标题: [求助] .htaccess与nginx规则问题 [打印本页]

作者: baike    时间: 2016-9-13 22:07     标题: .htaccess与nginx规则问题

下面是.htaccess规则  用apache环境访问正常
RewriteEngine On

RewriteRule ^index.html$ /index.php [L]


RewriteRule ^search.html$ search/search_kw.php [L]
RewriteRule ^search/(.*).html$ search/search_article.php?p=$1  [L]

RewriteRule ^m/(.*)-m.html$ m/m_article.php?p=$1  [L]
RewriteRule ^m/(.*).html$ m/index.php?c=$1  [L]

RewriteRule ^search/(.*)/([0-9]+)/$ search/search.php?kw=$1&t=1&page=$2  [L]
RewriteRule ^search/(.*)/$ search/search.php?kw=$1&t=1 [L]

RewriteRule ^tags/(.*)/([0-9]+)/$ search/search.php?kw=$1&t=2&page=$2  [L]
RewriteRule ^tags/(.*)/$ search/search.php?kw=$1&t=2 [L]

RewriteRule ^list/(.*)/([0-9]+).html$ list.php?c=$1&page=$2  [L]
RewriteRule ^list/(.*).html$ list.php?c=$1&page=1  [L]


RewriteRule ^article/20(.*)/(.*).html$ article/article.php?riqi=$1&p=$2 [L]
RewriteRule ^(.*)/20(.*)/(.*).html$ article.php?riqi=$2&p=$3&c=$1 [L]

RewriteRule ^article/(.*)/([0-9]+).html$ article/list.php?c=$1&page=$2  [L]
RewriteRule ^article/(.*).html$ article/list.php?c=$1 [L]
RewriteRule ^tags/index.html$ tags/index.php [L]

RewriteRule ^(.*).html$ search/search_article.php?p=$1  [L]



下面是nginx规则  怎么调试都显示403错误
rewrite ^/index.html$ /index.php last;


rewrite ^/search.html$ search/search_kw.php last;
rewrite ^/search/(.*).html$ search/search_article.php?p=$1 last;

rewrite ^/m/(.*)-m.html$ m/m_article.php?p=$1 last;
rewrite ^/m/(.*).html$ m/index.php?c=$1 last;

rewrite ^/search/(.*)/([0-9]+)/$ search/search.php?kw=$1&t=1&page=$2 last;
rewrite ^/search/(.*)/$ search/search.php?kw=$1&t=1 last;

rewrite ^/tags/(.*)/([0-9]+)/$ search/search.php?kw=$1&t=2&page=$2 last;
rewrite ^/tags/(.*)/$ search/search.php?kw=$1&t=2 last;

rewrite ^/list/(.*)/([0-9]+).html$ list.php?c=$1&page=$2 last;
rewrite ^/list/(.*).html$ list.php?c=$1&page=1 last;


rewrite ^/article/20(.*)/(.*).html$ article/article.php?riqi=$1&p=$2 last;
rewrite ^/(.*)/20(.*)/(.*).html$ article.php?riqi=$2&p=$3&c=$1 last;

rewrite ^/article/(.*)/([0-9]+).html$ article/list.php?c=$1&page=$2 last;
rewrite ^/article/(.*).html$ article/list.php?c=$1 last;
rewrite ^/tags/index.html$ tags/index.php last;

rewrite ^/(.*).html$ search/search_article.php?p=$1 last;





欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/) Powered by Discuz! 7.2