1.IIS 下偽靜態設置
首先請下載以下附件: IIS Rewrite模塊 附件:Rewrite.rar
其中httpd.ini為配置文件內容如下:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rewrite 系統規則請勿修改 PHPCMS3.0
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
將其解壓到任意目錄,如: C:/Rewrite
打開“控制面板→治理工具→IIS信息服務治理器→網站→您的站點→屬性”。在“ISAPI篩選器”項點擊 “添加”, 篩選器名稱填入Rewrite,可執行文件為C:/Rewrite/Rewrite.dll (假如您解壓到其它目錄請填入相應地址)
重新啟動IIS.
看到狀態為向上時成功。
2.Apache 下偽靜態設置
請首先咨詢您的空間服務商,空間是否支持 Rewrite 以及是否支持對站點目錄中 .htaccess 的文件解析,否則即便按照下面的方法設置好了,也無法使用。(需要服務器支持Apache的Mod_Rewrite功能)
服務器端設置 rewrite:
1,虛擬主機用戶:
------------------------------------------------------------------------
打開文件httpd.conf 文件(apache目錄下面的文件)
以apache2.2.3設置為例,配置虛擬主機下的rewrite
在主目錄里面需要添加代碼 AllowOverride Options FileInfo
取消 LoadModule rewrite_module modules/mod_rewrite.so前面的 #
重新啟動Apache.
-------------------------------------------------------------------------
Apache Web Server(獨立主機用戶):
首先確定您使用的 Apache 版本,及是否加載了 mod_rewrite 模塊。
新聞熱點
疑難解答