轻博客伪静态
最新支持到v3.0并兼容所有旧版本
阿帕奇:.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 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 ^/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>
</rules>
</rewrite>
</system.webServer>
</configuration>
技术资料 2020-01-25 15:28:33 通过 网页 浏览(7048)
评论已关闭!