PbootCMS伪静态配置-IIS7+环境-Apache环境-Nginx环境

日期:2020年09月03日 /人气: /来源:本站原创

PbootCMS程序在IIS7+环境-Apache环境-Nginx环境中伪静态配置方法。

一、IIS7+环境

#1.X版本使用如下规则:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                 <rule name="reIndex" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="true" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

#2.X+版本使用如下规则:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                 <rule name="reIndex" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="true" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?p={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

二、Apache环境

#1.X版本使用如下规则:
<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
 
  #如果页面出现"No input file specified." 请注释第一条,启用第二条
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
  #RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L]  
 
</IfModule>

#2.X+版本使用如下规则:
<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
 
  RewriteRule ^(.*)$ index.php?p=$1 [QSA,PT,L]

</IfModule>

三、Nginx环境


#1.X版本使用如下规则:
location / {
    if (!-e $request_filename){
        rewrite ^/(.*)$ /index.php/$1 last;
     }
}

#2.X+版本使用如下规则:
location / {
    if (!-e $request_filename){
        rewrite ^/(.*)$ /index.php?p=$1 last;
     }
}

作者:chuangxinkeji