dqlb123 发表于 2021-4-23 21:39:39

求大神帮忙把阿帕奇规则改成Nginx伪静态,用工具转换不行

本帖最后由 dqlb123 于 2021-4-23 21:42 编辑

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(baidu\.com)(:80)?
RewriteRule ^(.*) http://www.baidu.com/$1
RewriteRule ^api/baidu_sitemap_(+).xml$api/baidu_sitemap.php?page=$1;
RewriteRule ^api/baidu_sitemap.xml$api/baidu_sitemap.php;
RewriteRule ^xuanhuan/$ /modules/article/articlelist.php?class=1
RewriteRule ^wuxia/$ /modules/article/articlelist.php?class=2
RewriteRule ^dushi/$ /modules/article/articlelist.php?class=3
RewriteRule ^lishi/$ /modules/article/articlelist.php?class=4
RewriteRule ^youxi/$ /modules/article/articlelist.php?class=5
RewriteRule ^kehuan/$ /modules/article/articlelist.php?class=6
RewriteRule ^qita/$ /modules/article/articlelist.php?class=7
RewriteRule ^xuanhuan/(+)/$ /modules/article/articlelist.php?class=1&page=$1
RewriteRule ^wuxia/(+)/$ /modules/article/articlelist.php?class=2&page=$1
RewriteRule ^dushi/(+)/$ /modules/article/articlelist.php?class=3&page=$1
RewriteRule ^lishi/(+)/$ /modules/article/articlelist.php?class=4&page=$1
RewriteRule ^youxi/(+)/$ /modules/article/articlelist.php?class=5&page=$1
RewriteRule ^kehuan/(+)/$ /modules/article/articlelist.php?class=6&page=$1
RewriteRule ^qita/(+)/$ /modules/article/articlelist.php?class=7&page=$1
RewriteRule ^fenlei/(+)_(+)/$ /modules/article/articlelist.php?class=$1&page=$2
RewriteRule ^top/(+)_(+)/$ /modules/article/toplist.php?sort=$1&page=$2
RewriteRule ^gengxin.html$ /modules/article/toplist.php?sort=lastupdate
RewriteRule ^paihang.html$ /modules/article/52mb_paihang.php
RewriteRule ^all.html$ /modules/article/52mb_quanbu.php
RewriteRule ^book/(+).html$ modules/article/articleinfo.php?id=$1
RewriteRule ^(+)/(+)/$ /modules/article/reader.php?aid=$2
RewriteRule ^(+)/(+)/index.html$ /modules/article/reader.php?aid=$2
RewriteRule ^(+)/(+)/(+).html$ /modules/article/reader.php?aid=$2&cid=$3
RewriteRule ^52mb/(.*).html$ /404.html
RewriteRule ^templates/(.*).html$ /404.html
RewriteRule ^themes/52mb/(.*).html$ /404.html
RewriteRule ^modules/article/templates/$ /404.html
RewriteRule ^modules/article/templates/(.*).html$ /404.html
RewriteRule ^zuijingenxin.html$ modules/article/toplist.php?sort=lastupdate

guojing318 发表于 2021-4-23 21:54:40

百度的规则:lol

leven5 发表于 2021-4-23 22:10:11

好家伙,规则都精确到指定参数了,写这个东西的人真是个人才

trips 发表于 2021-4-24 03:53:22

看着好像是帝国的?https://cdn.jsdelivr.net/gh/hishis/forum-master/public/images/patch.gif

嗷嗷 发表于 2021-4-24 04:01:26

这也太长了

lovees 发表于 2021-4-24 05:07:40

location / {
if ($http_host ~* "^(baidu\.com)(:80)?"){
    rewrite ^/(.*) http://www.baidu.com/$1 redirect;
}
rewrite ^/(+)/(+)/$ /modules/article/reader.php?aid=$2;
rewrite ^/(+)/(+)/index.html$ /modules/article/reader.php?aid=$2;
rewrite ^/(+)/(+)/(+).html$ /modules/article/reader.php?aid=$2&cid=$3;
}

location /api {
rewrite ^/api/baidu_sitemap_(+).xml$ /api/baidu_sitemap.php?page=$1;;
}

location = /api/baidu_sitemap.xml {
rewrite ^(.*)$ /api/baidu_sitemap.php;;
}

location = /xuanhuan {
rewrite ^(.*)$ /modules/article/articlelist.php?class=1;
}

location = /wuxia {
rewrite ^(.*)$ /modules/article/articlelist.php?class=2;
}

location = /dushi {
rewrite ^(.*)$ /modules/article/articlelist.php?class=3;
}

location = /lishi {
rewrite ^(.*)$ /modules/article/articlelist.php?class=4;
}

location = /youxi {
rewrite ^(.*)$ /modules/article/articlelist.php?class=5;
}

location = /kehuan {
rewrite ^(.*)$ /modules/article/articlelist.php?class=6;
}

location = /qita {
rewrite ^(.*)$ /modules/article/articlelist.php?class=7;
}

location /xuanhuan {
rewrite ^/xuanhuan/(+)/$ /modules/article/articlelist.php?class=1&page=$1;
}

location /wuxia {
rewrite ^/wuxia/(+)/$ /modules/article/articlelist.php?class=2&page=$1;
}

location /dushi {
rewrite ^/dushi/(+)/$ /modules/article/articlelist.php?class=3&page=$1;
}

location /lishi {
rewrite ^/lishi/(+)/$ /modules/article/articlelist.php?class=4&page=$1;
}

location /youxi {
rewrite ^/youxi/(+)/$ /modules/article/articlelist.php?class=5&page=$1;
}

location /kehuan {
rewrite ^/kehuan/(+)/$ /modules/article/articlelist.php?class=6&page=$1;
}

location /qita {
rewrite ^/qita/(+)/$ /modules/article/articlelist.php?class=7&page=$1;
}

location /fenlei {
rewrite ^/fenlei/(+)_(+)/$ /modules/article/articlelist.php?class=$1&page=$2;
}

location /top {
rewrite ^/top/(+)_(+)/$ /modules/article/toplist.php?sort=$1&page=$2;
}

location = /gengxin.html {
rewrite ^(.*)$ /modules/article/toplist.php?sort=lastupdate;
}

location = /paihang.html {
rewrite ^(.*)$ /modules/article/52mb_paihang.php;
}

location = /all.html {
rewrite ^(.*)$ /modules/article/52mb_quanbu.php;
}

location /book {
rewrite ^/book/(+).html$ /modules/article/articleinfo.php?id=$1;
}

location /52mb {
rewrite ^/52mb/(.*).html$ /404.html;
}

location /templates {
rewrite ^/templates/(.*).html$ /404.html;
}

location /themes {
rewrite ^/themes/52mb/(.*).html$ /404.html;
}

location = /modules/article/templates {
rewrite ^(.*)$ /404.html;
}

location /modules {
rewrite ^/modules/article/templates/(.*).html$ /404.html;
}

location = /zuijingenxin.html {
rewrite ^(.*)$ /modules/article/toplist.php?sort=lastupdate;
}

烟雨a 发表于 2021-5-1 23:23:32

这是杰奇吧
页: [1]
查看完整版本: 求大神帮忙把阿帕奇规则改成Nginx伪静态,用工具转换不行