cari

Rumah  >  Soal Jawab  >  teks badan

php - 求助:Apache的rewrite规则转换成nginx的

<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>

怪我咯怪我咯2789 hari yang lalu697

membalas semua(2)saya akan balas

  • 巴扎黑

    巴扎黑2017-04-11 09:15:15

    把RewriteRule 改成rewrite 就好了吧

    balas
    0
  • 巴扎黑

    巴扎黑2017-04-11 09:15:15

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

    balas
    0
  • Batalbalas