PbootCMS 伪静态教程

Apache环境和IIS环境默认在根目录加了伪静态规则了,不需要操作,只要主机支持伪静态即可。

Nginx环境,请打开nginx.txt文件,把里面的代码复制到配置中,下面我们以宝塔为例,

伪静态规则的文件在或者看本文末尾

如何设置伪静态规则

IIS7+环境

<?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环境

<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环境

location / {
	 if (!-e $request_filename){
	    	rewrite ^/index.php(.*)$ /index.php?p=$1 last;
            	rewrite  ^(.*)$          /index.php?s=$1 last;
	 }
}

发表回复

后才能评论