雲伺服器 Z-BlogPHP 偽靜態規則設定

126雲發表於2021-05-07

首先在後臺外掛管理中開啟【靜態管理中心】,然後進入管理儲存偽靜態的執行方式。


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>




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69957453/viewspace-2771142/,如需轉載,請註明出處,否則將追究法律責任。

相關文章