偽靜態(tài)設置(2)_PHPCms教程
Apache 1.x 的用戶請檢查 conf/httpd.conf 中是否存在如下兩段代碼:
LoadModule rewrite_module libexec/mod_rewrite.soAddModule mod_rewrite.c
Apache 2.x 的用戶請檢查 conf/httpd.conf 中是否存在如下一段代碼:
LoadModule rewrite_module modules/mod_rewrite.so假如存在,那么在配置文件(通常就是 conf/httpd.conf)中加入如下代碼。此時請務必注重,假如網站使用通過虛擬主機來定義,
請務必加到虛擬主機配置,即 <VirtualHost> 中去,假如加在虛擬主機配置外部將可能無法使用。改好后然后將 Apache 重啟。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)show-([0-9] )-([0-9] )\.html$ $1/show.php?itemid=$2&page=$3
RewriteRule ^(.*)list-([0-9] )-([0-9] )\.html$ $1/list.php?catid=$2&page=$3
RewriteRule ^(.*)show-([0-9] )\.html$ $1/show.php?specialid=$2
</IfModule>
假如沒有安裝 mod_rewrite,您可以重新編譯 Apache,并在原有 configure 的內容中加入 --enable-rewrite=shared,
然后再在 Apache 配置文件中加入上述代碼即可。
2, 將以下代碼保存為.htaccess 并上傳到網站目錄下

# 將 RewriteEngine 模式打開
RewriteEngine On
# 修改以下語句中的 / 為你的網站目錄地址,假如程序放在二級目錄中,如/phpcms 請將 / 修改為 /phpcms
RewriteBase /
# Rewrite 系統(tǒng)規(guī)則請勿修改
RewriteRule ^(.*)show-([0-9] )-([0-9] )\.html$ $1/show.php?itemid=$2&page=$3
RewriteRule ^(.*)list-([0-9] )-([0-9] )\.html$ $1/list.php?catid=$2&page=$3
RewriteRule ^(.*)show-([0-9] )\.html$ $1/show.php?specialid=$2
或者下面下面的文件到網站目錄:點擊下載
3,設置頻道的生成方式:
某頻道下---頻道參數設置--生成方式

4,效果如圖:

- 相關鏈接:
- 教程說明:
PHPCms教程-偽靜態(tài)設置(2)
。