一条大河

关于 Z-Blog 在二级目录安装的伪静态规则设置

2.jpg

Nginx 伪静态规则(推荐)

location /news
{
  if (-f $request_filename/index.html){
    rewrite (.*) $1/index.html break;
  }
  
  if (-f $request_filename/index.php){
    rewrite (.*) $1/index.php;
  }
  
  if (!-f $request_filename){
    rewrite (.*) /news/index.php;
  }
}

Apache 伪静态规则

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /news/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /news/index.php [L]
</IfModule>

IIS 伪静态规则

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
  <rewrite>
   <rules>
 <rule name="/news/ 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="/news/ 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>


发表评论

◎发表您的看法、交流您的观点,保持友善言论。

搜索
近期留言
近期发表
站点标签
©
 iddahe.com / PHP函数速查 / 服务器资源 / 代理IP资源 / 海内外高防CDN / 咨询及反馈 / 需求定制 / 使用协议
一条大河(一会儿是风,一会儿是水) Z-BlogPHP 驱动 / Theme: Hipaper / RSS / Sitemap