讓企業贏在全網營銷時代
當前位置: 首頁>>建站知識>>PC建站

PbootCMS偽靜態教程設置方法介紹

作者:超級管理員 點擊量:2020次 2022-03-16 22:11:31

1、去后臺配置參數-URL規則下選擇偽靜態模式,保存。

31.jpg

2、根據服務器環境添加偽靜態規則

網站根目錄下有個rewrite文件里有三種偽靜態方式,根據實際情況選擇使用。

1、IIS7+環境(IIS6的環境自行百度):

1)安裝rewrite組件,如果使用空間一般空間商默認已經安裝;

2)到后臺配置參數中開啟偽靜態開關;

3)在站點目錄建立web.config文件(可到源碼包rewrite目錄下拷貝規則),規則內容如下:

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

2、Apache環境偽靜態配置

一般apache環境的把htaccess文件復制一份到根目錄上即可

32.jpg

如果是Apache環境卻使用無效,請確認htaccess文件是否被修改,PbootCMS自帶的默認為:

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

3、Nginx環境偽靜態配置

以下以寶塔為栗子介紹

1、復制根目錄下的nginx.txt里的偽靜態規則(規則適合PbootCMS V2.0+版本)

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

2、找到對應的網站,點擊設置

image.png

3、在彈出的窗口里找到偽靜態,然后復制上面的規則進去,保存即可。

image.png


人人妻人人澡人人爽欧美精品