作者:超级管理员 点击量:5279次 2022-03-16 22:11:31
1、去后台配置参数-URL规则下选择伪静态模式,保存。
2、根据服务器环境添加伪静态规则
网站根目录下有个rewrite文件里有三种伪静态方式,根据实际情况选择使用。
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>
一般apache环境的把htaccess文件复制一份到根目录上即可
如果是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>
以下以宝塔为栗子介绍
1、复制根目录下的nginx.txt里的伪静态规则(规则适合PbootCMS V2.0+版本)
location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php?p=$1 last; } }
2、找到对应的网站,点击设置
3、在弹出的窗口里找到伪静态,然后复制上面的规则进去,保存即可。