Pbootcms網(wǎng)站偽靜態(tài)配置
偽靜態(tài)配置
標(biāo)簽作用:配置程序偽靜態(tài)后URL中將不再包含index.php,整個(gè)地址更美觀。
網(wǎng)站模板地址:http://demo.bang-dun.com/
模板安裝教程:http://demo.bang-dun.com/anzhuang/jiaocheng.html?
偽靜態(tài)教程:http://demo.bang-dun.com/jishu/322.html

1、IIS環(huán)境(IIS6的環(huán)境自行百度):
1)安裝rewrite組件,如果使用空間一般空間商默認(rèn)已經(jīng)安裝;
2)到后臺(tái)配置參數(shù)中開啟偽靜態(tài)開關(guān)(老版本直接修改程序config/config.php文件url_type=2);
3)在站點(diǎn)目錄建立web.config文件(老版本根目錄下默認(rèn)已有,去除后綴bak即可,新版本到rewrite目錄下拷貝規(guī)則),手動(dòng)建立的話規(guī)則如下:
<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>
2、Apache環(huán)境
1)開啟Apache重寫模塊,具體請百度,如果使用空間一般空間商默認(rèn)已經(jīng)開啟;
2)到后臺(tái)配置參數(shù)中開啟偽靜態(tài)開關(guān)(老版本直接修改程序config/config.php文件url_type=2);
3)在站點(diǎn)目錄建立.htaccess文件(老版本根目錄下默認(rèn)已有,新版本到rewrite目錄下拷貝規(guī)則),內(nèi)容如下:
<IfModule?mod_rewrite.c> ?Options?+FollowSymlinks ?RewriteEngine?On ?RewriteCond?%REQUEST\_FILENAME?!-d RewriteCond?%REQUEST\_FILENAME?!-f #如果頁面出現(xiàn)"No?input?file?specified."?請注釋第一條,啟用第二條 RewriteRule?^(.\*)$?index.php/$1?\[QSA,PT,L\]#RewriteRule?^(.\*)$?index.php?\[E=PATH\_INFO:$1,QSA,PT,L\]

2、Nginx環(huán)境
1、到后臺(tái)配置參數(shù)中開啟偽靜態(tài)(老版本直接修改程序config/config.php文件url_type=2);
2、在nginx虛擬主機(jī)location配置中添加規(guī)則,規(guī)則如下:
????location?/?{?? ??if?(!-e?$request_filename){?? ??rewrite?^/(.)$?/index.php/$1?last;????? ??????}??? ?}
注意:Nginx中如果站點(diǎn)部署在二級目錄,請對應(yīng)修改重寫規(guī)則, 如:二級目錄為test則:rewrite ^/test/(.)$ /test/index.php/$1 last;
附:nginx開啟PHP及pathinfo支持的方法,在server內(nèi)部添加如下內(nèi)容:
location?~?\.php(.*)$?{root?D:/wwwroot;??#你的網(wǎng)站目錄 fastcgi_pass?127.0.0.1:9000;??#php-cgi監(jiān)聽地址 fastcgi_index?index.php;??#默認(rèn)頁 fastcgi_split_path_info?^(.+\.php)(.*)$;??#分離路徑 fastcgi_param?PATH_INFO?$fastcgi_path_info;??#添加PATH_INFO信息 fastcgi_param?SCRIPT_FILENAME?$document_root$fastcgi_script_name;fastcgi_param?PATH_TRANSLATED?$document_root$fastcgi_path_info;include?fastcgi_params;}