#帮助#轻博客伪静态规则
本规则于2020/08/03日更新适用于2.0以上版本
Apache: .htaccess
#Options +FollowSymlinks #本条非必需
RewriteEngine on
#博客安装目录以/结尾
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule post-([0-9]+)\.html$ index.php?act=pl&id=$1 [L]
RewriteRule comment-([0-9]+)\.html$ index.php?act=plist&p=$1 [L]
RewriteRule index-([0-9]+)\.html$ index.php?p=$1 [L]
RewriteRule list-([0-9]+)\.html$ index.php?tid=$1 [L]
RewriteRule list-([0-9]+)-([0-9]+)\.html$ index.php?tid=$1&p=$2 [L]
RewriteRule index\.html$ index.php [L]
RewriteRule archives\.html$ index.php?act=archives [L]
RewriteRule comment\.html$ index.php?act=plist [L]
Ngnix:
rewrite ^/post-([0-9]+).html /index.php?act=pl&id=$1 last;
rewrite ^/comment-([0-9]+).html /index.php?act=plist&p=$1 last;
rewrite ^/index-([0-9]+).html /index.php?p=$1 last;
rewrite ^/list-([0-9]+)\.html$ /index.php?tid=$1 last;
rewrite ^/list-([0-9]+)-([0-9]+)\.html$ /index.php?tid=$1&p=$2 last;
rewrite ^/index.html /index.php last;
rewrite ^/archives.html /index.php?act=archives last;
rewrite ^/comment.html /index.php?act=plist last;
IIS:web.config :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rule11" stopProcessing="true">
<match url="^post-([0-9]+).html" />
<action type="Rewrite" url="index.php?act=pl&id={R:1}" />
</rule>
<rule name="rule13" stopProcessing="true">
<match url="^comment-([0-9]+).html" />
<action type="Rewrite" url="index.php?act=plist&p={R:1}" />
</rule>
<rule name="rule14" stopProcessing="true">
<match url="^index-([0-9]+).html" />
<action type="Rewrite" url="index.php?p={R:1}" />
</rule>
<rule name="rule15" stopProcessing="true">
<match url="^index.html" />
<action type="Rewrite" url="index.php" />
</rule>
<rule name="rule16" stopProcessing="true">
<match url="^comment.html" />
<action type="Rewrite" url="index.php?act=plist" />
</rule>
<rule name="rule17" stopProcessing="true">
<match url="list-([0-9]+).html" />
<action type="Rewrite" url="index.php?tid={R:1}" />
</rule>
<rule name="rule18" stopProcessing="true">
<match url="list-([0-9]+)-([0-9]+).html" />
<action type="Rewrite" url="index.php?tid={R:1}&p={R:2}" />
</rule>
<rule name="rule19" stopProcessing="true">
<match url="archives.html" />
<action type="Rewrite" url="index.php?act=archives" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
2019-04-17 09:49:16 通过 网页 浏览(3508)
共有13条评论!
Ngnix 无用
回复:已更正,宝塔面板ngnix测试通过
https://i.bmp.ovh/imgs/2019/07/46ef5eb68ebc2da7.png
回复:然后问题呢?
伪静态要更新了,增加了list
伪静态要更新了,增加了list
.htaccess 网站添加了分类后 静态规则就不能用了,希望早日更新!
回复:回复以上所有:已更新
Apache: .htaccess ... RewriteRule list-([0-9]+)-([0-9]+)\.html$ index.php?tid=$1&p=$2 [L] ... ---修改为以下才生效---- RewriteRule list-([0-9]+)\.html$ index.php?tid=$1&p=$2 [L] 原因不详
回复:已更新
IIS: 需要改为 否则出错
index.php?tid={R:1}&p={R:2}
回复:已经修改。
二级目录下安装呢?
回复:运行环境?Apache修改 RewriteBase /二级目录/
RewriteRule archive\.html$ index.php?act=archive [L] 需要改为 RewriteRule archives\.html$ index.php?act=archives [L]
回复:已更正
没有伪静态和有伪静态网址同时存在,会不会有影响?
回复:不影响。
lnmp Ngnix 无用!删掉index.php?手动输入正常,但页面里的其他url还是错的
回复:自己后台开启下。没开启当然不起作用。
头疼不会写规则