云服务器 Z-BlogPHP 伪静态规则设置

蜗牛vps教程2021-03-053800

首先在后台插件管理中开启【静态管理中心】,然后进入管理保存伪静态的运行方式。


IIS6 保存一下代码为 httpd.ini 到网站根目录,自动生效。

[ISAPI_Rewrite]

RewriteRule /page_([0-9]*)\.html /index\.php\?page=$1&rewrite=1&full_uri=$0 [I,L]
RewriteRule /date-([0-9\-]+)(?:_)?([0-9]*)\.html /index\.php\?date=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /author-([0-9]+)(?:_)?([0-9]*)\.html /index\.php\?auth=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /tags-([0-9]+)(?:_)?([0-9]*)\.html /index\.php\?tags=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /category-([0-9]+)(?:_)?([0-9]*)\.html /index\.php\?cate=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /post/([0-9]+)\.html(\?.*)? /index\.php\?id=$1&rewrite=1&full_uri=$0 [I,L]
RewriteRule /([0-9]+)\.html(\?.*)? /index\.php\?id=$1&rewrite=1&full_uri=$0 [I,L]


IIS7保存代码为 web.config 到网站根目录,自动生效。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
  <rewrite>
   <rules>
 <rule name="/ Z-BlogPHP Imported Rule" stopProcessing="true">
  <match url="^.*?" ignoreCase="false" />
   <conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
   </conditions>
  <action type="Rewrite" url="index.php/{R:0}" />
 </rule>
 <rule name="/ Z-BlogPHP Imported Rule index.php" stopProcessing="true">
  <match url="^index.php/.*?" ignoreCase="false" />
   <conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" />
   </conditions>
  <action type="Rewrite" url="index.php/{R:0}" />
 </rule>
   </rules>
  </rewrite>
 </system.webServer>
</configuration>


评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论Telegram