ITPub博客

首页 > 云计算 > 虚拟化 > 云服务器 Z-BlogPHP 伪静态规则设置

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

虚拟化 作者:126云 时间:2021-05-07 13:58:06 0 删除 编辑

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


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博客 ” ,链接:https://blog.itpub.net/69957453/viewspace-2771142/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
文章来自网络,如有侵害,请私信

注册时间:2019-12-14

  • 博文量
    344
  • 访问量
    257075