#帮助#轻博客伪静态规则

本规则于2019/11/29日更新适用于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 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&amp;id={R:1}" />
</rule>
<rule name="rule13" stopProcessing="true">
<match url="^comment-([0-9]+).html" />
<action type="Rewrite" url="index.php?act=plist&amp;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}&amp;p={R:2}" />
</rule>
</rules>
</rewrite>
</system.webServer>     
</configuration>

2019-04-17 09:49:16 通过 网页 浏览(1008)

共有8条评论!

  1. Ngnix 2019-04-19 11:34:32 1#

    Ngnix 无用

      回复已更正,宝塔面板ngnix测试通过

  2. 绿匣子 2019-07-10 05:07:09 2#

    https://i.bmp.ovh/imgs/2019/07/46ef5eb68ebc2da7.png

      回复然后问题呢?

  3. we 2019-11-22 00:14:11 3#

    伪静态要更新了,增加了list

  4. 辣辣 2019-11-24 12:16:38 4#

    伪静态要更新了,增加了list

  5. 伪静态规则需要更新了 2019-11-26 17:38:23 5#

    .htaccess 网站添加了分类后 静态规则就不能用了,希望早日更新!

      回复回复以上所有:已更新

  6. 辣辣 2019-12-04 09:29:12 6#

    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] 原因不详

      回复已更新

  7. Test 2020-01-13 14:07:19 7#

    IIS: 需要改为 否则出错

  8. Test 2020-01-13 14:08:03 8#

    index.php?tid={R:1}&p={R:2}

      回复已经修改。

发表评论