SupSite/X-Space 啟用Rewrite說明
------------------------------
http://www.supesite.com


===============================================
+ 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

# 如果你以前啟用過HTML,且在升級後將原HTML文件刪除,為了使以前的鏈接地址有效,可加入下一條Rewrite規則(將規則前的'#'去掉)
#
#RewriteRule ^html/([0-9]+)/viewnews_itemid_([0-9]+)\.html$ index.php?action_viewnews_itemid_$2

-----------------------------------------------------------------------

添加內容時,請遵照上面的提示,修改程序所在的路徑
然後保存為文件 .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)中加入如下代碼
此時請務必注意,如果網站使用通過虛擬主機來定義
請務必加到虛擬主機配置,即  中去,如果加在虛擬主機配置外部將可能無法使用
改好後然後將 Apache 重啟。 

注意:

以下規則,僅適用於程序可以通過獨立域名或者二級域名直接訪問。
如果您的程序需要域名後面加目錄名的方式才可以訪問,那麼,您需要手工修改以下規則:

將 「^/」                 修改為 「^/xxx/」
將 「/index.php」         修改為 「/xxx/index.php」

其中,xxx 為您的程序目錄名

-----------------------------------------------------------------------


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

# 如果你以前啟用過HTML,且在升級後將原HTML文件刪除,為了使以前的鏈接地址有效,可加入下一條Rewrite規則(將規則前的'#'去掉)
#
#RewriteRule /html/([0-9]+)/viewnews_itemid_([0-9]+)\.html$ /index.php?action_viewnews_itemid_$2


-----------------------------------------------------------------------

如果沒有安裝 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規則,請重啟網站,使規則生效

相關軟件(iisrewrite.zip)下載和圖文嚮導,請參看以下網址:
http://www.discuz.net/thread-276141-1-2.html


===============================================
+ Zeus服務器(針對Zeus V4.X,且僅針對獨立主機)
===============================================

-----------------------------------------------------------------------

RULE_0_START:
match URL into $ with ^/supesite/([0-9]+)/spacelist(.*)$
if not matched then goto RULE_0_END
set URL = /supesite/index.php?$1/action_spacelist$2
RULE_0_END:

RULE_1_START:
match URL into $ with ^/supesite/([0-9]+)/viewspace(.+)$
if not matched then goto RULE_1_END
set URL = /supesite/index.php?$1/action_viewspace_itemid$2
RULE_1_END:

RULE_2_START:
match URL into $ with ^/supesite/([0-9]+)/viewbbs(.+)$
if not matched then goto RULE_2_END
set URL = /supesite/index.php?$1/action_viewbbs_tid$2
RULE_2_END:

RULE_3_START:
match URL into $ with ^/supesite/([0-9]+)/(.*)$
if not matched then goto RULE_3_END
set URL = /supesite/index.php?$1/$2
RULE_3_END:

RULE_4_START:
match URL into $ with ^/supesite/([0-9]+)$
if not matched then goto RULE_4_END
set URL = /supesite/index.php?$1
RULE_4_END:

RULE_5_START:
match URL into $ with ^/supesite/action(.+)$
if not matched then goto RULE_5_END
set URL = /supesite/index.php?action$1
RULE_5_END:

RULE_6_START:
match URL into $ with ^/supesite/([0-9]+)(.*)$
if not matched then goto RULE_6_END
set URL = /supesite/index.php?action/space/uid/$1$2
RULE_6_END:

RULE_7_START:
match URL into $ with ^/supesite/category(.+)$
if not matched then goto RULE_7_END
set URL = /supesite/index.php?action_category_catid$1
RULE_7_END:

RULE_8_START:
match URL into $ with ^/supesite/itemlist(.+)$
if not matched then goto RULE_8_END
set URL = /supesite/index.php?action_itemlist_catid$1
RULE_8_END:

RULE_9_START:
match URL into $ with ^/supesite/viewnews(.+)$
if not matched then goto RULE_9_END
set URL = /supesite/index.php?action_viewnews_itemid$1
RULE_9_END:

RULE_10_START:
match URL into $ with ^/supesite/viewthread(.+)$
if not matched then goto RULE_10_END
set URL = /supesite/index.php?action_viewthread_tid$1
RULE_10_END:

RULE_11_START:
match URL into $ with ^/supesite/index([\.a-zA-Z0-9]*)$
if not matched then goto RULE_11_END
set URL = /supesite/index.php
RULE_11_END:

RULE_12_START:
match URL into $ with ^/supesite/html/([0-9)+)/viewnews_itemid_([0-9]+)\.html$
if not matched then goto RULE_12_END
set URL = /supersite/index.php?action_viewnews_itemid_$2
RULE_12_END:
-----------------------------------------------------------------------



(C) 2001-2006 Comsenz Inc.