.
SupSite/X-Space 啟用Rewrite說明
------------------------------
http://www.supesite.com
http://X-Space.discuz.net
===============================================
+ Apache Web Server(虛擬主機用戶)
===============================================
在開始以下設置之前,請首先咨詢您的空間服務商
空間是否支持 Rewrite 以及是否支持對站點目錄中 .htaccess 的文件解析
否則即便按照下面的方法設置好了,也無法使用
注意:
以下規則,僅適用於程序可以通過獨立域名或者二級域名直接訪問。
如果您的程序需要域名後面加目錄名的方式才可以訪問,那麼,您需要手工修改以下規則:
將 “RewriteBase /” 修改為 “RewriteBase /xxx”
其中,“xxx” 為您的程序目錄名
-----------------------------------------------------------------------
RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]+)/spacelist_(.*)$ index.php?$1/action_spacelist_$2
RewriteRule ^([0-9]+)/viewspace_(.+)$ index.php?$1/action_viewspace_itemid_$2
RewriteRule ^([0-9]+)/viewbbs_(.+)$ index.php?$1/action_viewbbs_tid_$2
RewriteRule ^([0-9]+)/(.*)$ index.php?$1/$2
RewriteRule ^([0-9]+)$ index.php?$1
RewriteRule ^action_(.+)$ index.php?action_$1
RewriteRule ^category_(.+)$ index.php?action_category_catid_$1
RewriteRule ^itemlist_(.+)$ index.php?action_itemlist_catid_$1
RewriteRule ^viewnews_(.+)$ index.php?action_viewnews_itemid_$1
RewriteRule ^viewthread_(.+)$ index.php?action_viewthread_tid_$1
RewriteRule ^index([\.a-zA-Z0-9]*)$ index.php
-----------------------------------------------------------------------
添加內容時,請遵照上面的提示,修改程序所在的路徑
然後保存為文件 .htaccess 。將 .htaccess 文件上傳到SupeSite所在的目錄中
進入SupeSite 系統設置,根據需要開啟 URL 靜態化 功能
===============================================
+ Apache Web Server(獨立主機用戶)
===============================================
首先確定您使用的 Apache 版本,及是否加載了 mod_rewrite 模塊。
Apache 1.x 的用戶請檢查 conf/httpd.conf 中是否存在如下兩段代碼:
LoadModule rewrite_module libexec/mod_rewrite.so
AddModule mod_rewrite.c
Apache 2.x 的用戶請檢查 conf/httpd.conf 中是否存在如下一段代碼:
LoadModule rewrite_module modules/mod_rewrite.so
如果存在,那麼在配置文件(通常就是 conf/httpd.conf)中加入如下代碼
此時請務必注意,如果網站使用通過虛擬主機來定義
請務必加到虛擬主機配置,即 <VirtualHost> 中去,如果加在虛擬主機配置外部將可能無法使用
改好後然後將 Apache 重啟。
注意:
以下規則,僅適用於程序可以通過獨立域名或者二級域名直接訪問。
如果您的程序需要域名後面加目錄名的方式才可以訪問,那麼,您需要手工修改以下規則:
將 “^/” 修改為 “^/xxx/”
將 “/index.php” 修改為 “/xxx/index.php”
其中,xxx 為您的程序目錄名
-----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/([0-9]+)/spacelist_(.*)$ /index.php?$1/action_spacelist_$2
RewriteRule ^/([0-9]+)/viewspace_(.+)$ /index.php?$1/action_viewspace_itemid_$2
RewriteRule ^/([0-9]+)/viewbbs_(.+)$ /index.php?$1/action_viewbbs_tid_$2
RewriteRule ^/([0-9]+)/(.*)$ /index.php?$1/$2
RewriteRule ^/([0-9]+)$ /index.php?$1
RewriteRule ^/action_(.+)$ /index.php?action_$1
RewriteRule ^/category_(.+)$ /index.php?action_category_catid_$1
RewriteRule ^/itemlist_(.+)$ /index.php?action_itemlist_catid_$1
RewriteRule ^/viewnews_(.+)$ /index.php?action_viewnews_itemid_$1
RewriteRule ^/viewthread_(.+)$ /index.php?action_viewthread_tid_$1
RewriteRule ^/index([\.a-zA-Z0-9]*)$ /index.php
</IfModule>
-----------------------------------------------------------------------
如果沒有安裝 mod_rewrite,您可以重新編譯 Apache
並在原有 configure 的內容中加入 --enable-rewrite=shared
然後再在 Apache 配置文件中加入上述代碼即可。
進入SupeSite 系統設置,根據需要開啟 URL 靜態化 功能
===============================================
+ IIS服務器(Windows主機用戶)
===============================================
首先,需要安裝模塊
安裝方法是:將iisrewrite.zip中的文件解壓到服務器的一個目錄中。
打開IIS管理器 -> 選擇網站屬性 -> ISAPI篩選器 -> 在名稱中輸入rewrite ->
可執行文件選擇剛才解壓後的文件Rewrite.dll -> 點確定
-> 再點確定 -> 關閉屬性對話框
再次查看網站屬性 -> 到ISAPI篩選器
如果看到狀態為向上的綠色箭頭,就說明Rewrite模塊安裝成功了
然後,修改Rewrite規則
到剛才解壓的目錄下,找到httpd.ini文件
httpd.ini的規則,僅適用於程序可以通過獨立域名或者二級域名直接訪問。
如果您的程序需要域名後面加目錄名的方式才可以訪問,那麼,您需要手工修改httpd.ini的規則:
將 “^/” 修改為 “^/xxx/”
將 “/index\.php” 修改為 “/xxx/index\.php”
其中,xxx 為您的程序目錄名
一旦修改了Rewrite規則,請重啟網站,使規則生效
(C) 2001-2006 Comsenz Technology Ltd