php - 求助:Apache的rewrite规则转换成nginx的
怪我咯
怪我咯 2017-04-11 09:13:15
0
2
676

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(index|webdir|category|update|archives|top|feedback|link|rssfeed|sitemap)(/?)$ index.php?mod=$1
RewriteRule ^update/(d+).html$ index.php?mod=update&days=$1
RewriteRule ^update/([0-9]+)-([0-9]+).html$ index.php?mod=update&days=$1&page=$2
RewriteRule ^archives/(d+).html$ index.php?mod=archives&date=$1
RewriteRule ^archives/(d+)-(d+).html$ index.php?mod=archives&date=$1&page=$2
RewriteRule ^search/(name|url|tags|intro)/(.+)-(d+).html$ index.php?mod=search&type=$1&query=$2&page=$3
RewriteRule ^search/(name|url|tags|intro)/(.+).html$ index.php?mod=search&type=$1&query=$2
RewriteRule ^siteinfo/(d+).html$ index.php?mod=siteinfo&wid=$1
RewriteRule ^diypage/(d+).html$ index.php?mod=diypage&pid=$1
RewriteRule ^rssfeed/(d+).html$ index.php?mod=rssfeed&cid=$1
RewriteRule ^sitemap/(d+).html$ index.php?mod=sitemap&cid=$1
RewriteRule ^webdir/(.+)/(d+).html$ index.php?mod=webdir&cid=$2
RewriteRule ^webdir/(.+)/([0-9]+)-([0-9]+).html$ index.php?mod=webdir&cid=$2&page=$3
</IfModule>

怪我咯
怪我咯

走同样的路,发现不同的人生

모든 응답(2)
巴扎黑

把RewriteRule 改成rewrite 就好了吧

巴扎黑

rewrite ^/(index|webdir|category|update|archives|top|feedback|link|rssfeed|sitemap)(/?)$ index.php?mod=$1;
rewrite ^/update/(d+).html$ index.php?mod=update&days=$1;
rewrite ^/update/([0-9]+)-([0-9]+).html$ index.php?mod=update&days=$1&page=$2;
rewrite ^/archives/(d+).html$ index.php?mod=archives&date=$1;
rewrite ^/archives/(d+)-(d+).html$ index.php?mod=archives&date=$1&page=$2;
rewrite ^/search/(name|url|tags|intro)/(.+)-(d+).html$ index.php?mod=search&type=$1&query=$2&page=$3;
rewrite ^/search/(name|url|tags|intro)/(.+).html$ index.php?mod=search&type=$1&query=$2;
rewrite ^/siteinfo/(d+).html$ index.php?mod=siteinfo&wid=$1;
rewrite ^/diypage/(d+).html$ index.php?mod=diypage&pid=$1;
rewrite ^/rssfeed/(d+).html$ index.php?mod=rssfeed&cid=$1;
rewrite ^/sitemap/(d+).html$ index.php?mod=sitemap&cid=$1;
rewrite ^/webdir/(.+)/(d+).html$ index.php?mod=webdir&cid=$2;
rewrite ^/webdir/(.+)/([0-9]+)-([0-9]+).html$ index.php?mod=webdir&cid=$2&page=$3;

以后有相同的需求,可以http://tool.lu/htaccess2nginx/这个网址试试

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!