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

<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 就好了吧

いいねを押す +0
巴扎黑

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/这个网址试试

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート