• 确博日记
  • 工作时间:09:30 pm-06:24 pm

iis Z-BlogPHP 伪静态规则设置

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

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>

  • 在线列表
    1589813