Warning: Undefined array key "night" in /www/wwwroot/dhaomu.com/wp-content/themes/b2/header.php on line 18
首页>文档>PbootCMS>PbootCMS开发手册>PbootCMS开发手册之伪静态配置

PbootCMS开发手册之伪静态配置

pbootcms开源免费PHP建站系统开发手册之伪静态配置!熟悉PbootCMS手册是使用本程序开发模板的前提,虽然我们尽可能把所有标签做到简单到想哭,但是还是需要您静下心来好好看看!

标签作用:配置程序伪静态后URL中将不再包含兼容模式的问号,整个地址更美观,也便于推广优化。

适用版本:2.X 、3.X

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

安装rewrite组件,如果使用空间一般空间商默认已经安装;

到后台配置参数中开启伪静态开关;

在站点目录建立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文件(可到源码包rewrite目录下拷贝规则),规则内容如下:

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

到后台配置参数中开启伪静态;

在nginx虚拟主机location配置中添加规则,规则如下:

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

注意:Nginx中如果站点部署在二级目录,请对应修改重写规则。

 如:二级目录为test则:rewrite ^/test/(.*)$ /test/index.php?p=$1 last;

配置教程

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

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

伪静态规则的文件在

PbootCMS开发手册之伪静态配置插图
pbootcms开源免费PHP建站系统开发手册之伪静态配置
PbootCMS开发手册之伪静态配置插图1
pbootcms开源免费PHP建站系统开发手册之伪静态配置
PbootCMS开发手册之伪静态配置插图2
pbootcms开源免费PHP建站系统开发手册之伪静态配置
0 条回复 A文章作者 M管理员

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914
----《》
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索