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


===============================================
+ Apache Web Server(虛擬主機用戶)
===============================================


在開始以下設置之前,請首先咨詢您的空間服務商
空間是否支持 Rewrite 以及是否支持對站點目錄中 .htaccess 的文件解析
否則即便按照下面的方法設置好了,也無法使用

注意:

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

將 「RewriteBase /」         修改為 「RewriteBase /xxx」

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


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

###	將 RewriteEngine 模式打開
RewriteEngine On

###	修改以下語句中的 /supesite 修改為你的SupeSite目錄地址,如果程序放在根目錄中,請將 /supesite 修改為 /
RewriteBase /

###	Rewrite 系統規則請勿修改
RewriteRule ^([0-9]+)/spacelist(.+)$ index.php?uid/$1/action/spacelist/type$2 [L]
RewriteRule ^([0-9]+)/viewspace(.+)$ index.php?uid/$1/action/viewspace/itemid$2 [L]
RewriteRule ^([0-9]+)/viewbbs(.+)$ index.php?uid/$1/action/viewbbs/tid$2 [L]
RewriteRule ^([0-9]+)/(.*)$ index.php?uid/$1/$2 [L]
RewriteRule ^([0-9]+)$ index.php?uid/$1 [L]

RewriteRule ^action(.+)$ index.php?action$1 [L]
RewriteRule ^category(.+)$ index.php?action/category/catid$1 [L]
RewriteRule ^viewnews(.+)$ index.php?action/viewnews/itemid$1 [L]
RewriteRule ^viewthread(.+)$ index.php?action/viewthread/tid$1 [L]
RewriteRule ^mygroup(.+)$ index.php?action/mygroup/gid$1 [L]

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

添加內容時,請遵照上面的提示,修改程序所在的路徑
然後保存為文件 .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 為您的程序目錄名

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

<IfModule mod_rewrite.c>
RewriteEngine On

###	Rewrite 系統規則請勿修改
RewriteRule ^/([0-9]+)/spacelist(.+)$ /index.php?uid/$1/action/spacelist/type$2 [L]
RewriteRule ^/([0-9]+)/viewspace(.+)$ /index.php?uid/$1/action/viewspace/itemid$2 [L]
RewriteRule ^/([0-9]+)/viewbbs(.+)$ /index.php?uid/$1/action/viewbbs/tid$2 [L]
RewriteRule ^/([0-9]+)/(.*)$ /index.php?uid/$1/$2 [L]
RewriteRule ^/([0-9]+)$ /index.php?uid/$1 [L]

RewriteRule ^/action(.+)$ /index.php?action$1 [L]
RewriteRule ^/category(.+)$ /index.php?action/category/catid$1 [L]
RewriteRule ^/viewnews(.+)$ /index.php?action/viewnews/itemid$1 [L]
RewriteRule ^/viewthread(.+)$ /index.php?action/viewthread/tid$1 [L]
RewriteRule ^/mygroup(.+)$ /index.php?action/mygroup/gid$1 [L]

</IfModule>

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

如果沒有安裝 mod_rewrite,您可以重新編譯 Apache
並在原有 configure 的內容中加入 --enable-rewrite=shared
然後再在 Apache 配置文件中加入上述代碼即可。

進入SupeSite 系統設置,根據需要開啟 URL 靜態化 功能


===============================================
+ IIS服務器(Windows主機用戶)
===============================================


首先,需要安裝模塊

安裝方法是:將iisrewrite.zip中的文件解壓到服務器的一個目錄中。
iisrewrite.zip 下載地址:
http://www.supesite.com/tools/iisrewrite.zip

打開IIS管理器 -> 選擇網站屬性 -> ISAPI篩選器 -> 在名稱中輸入rewrite ->
可執行文件選擇剛才解壓後的文件Rewrite.dll -> 點確定
-> 再點確定 -> 關閉屬性對話框
再次查看網站屬性 -> 到ISAPI篩選器
如果看到狀態為向上的綠色箭頭,就說明Rewrite模塊安裝成功了

然後,修改Rewrite規則

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

將 「^/」                 修改為 「^/xxx/」
將 「/index\.php」         修改為 「/xxx/index\.php」
其中,xxx 為您的程序目錄名


一旦修改了Rewrite規則,請重啟網站,使規則生效


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

注意:

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

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

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

-----------------------------------------------------------------------
RULE_0_START:
match URL into $ with ^/([0-9]+)/spacelist(.+)$
if not matched then goto RULE_0_END
# Source line 1
# Second half of: RewriteRule ^/([0-9]+)/spacelist(.+)$ /index.php?uid/$1/action/spacelist/type$2 [L]
set URL = /index.php?uid/$1/action/spacelist/type$2
# This rule has [L]
goto END
RULE_0_END:

RULE_1_START:
match URL into $ with ^/([0-9]+)/viewspace(.+)$
if not matched then goto RULE_1_END
# Source line 2
# Second half of: RewriteRule ^/([0-9]+)/viewspace(.+)$ /index.php?uid/$1/action/viewspace/itemid$2 [L]
set URL = /index.php?uid/$1/action/viewspace/itemid$2
# This rule has [L]
goto END
RULE_1_END:

RULE_2_START:
match URL into $ with ^/([0-9]+)/viewbbs(.+)$
if not matched then goto RULE_2_END
# Source line 3
# Second half of: RewriteRule ^/([0-9]+)/viewbbs(.+)$ /index.php?uid/$1/action/viewbbs/tid$2 [L]
set URL = /index.php?uid/$1/action/viewbbs/tid$2
# This rule has [L]
goto END
RULE_2_END:

RULE_3_START:
match URL into $ with ^/([0-9]+)/(.*)$
if not matched then goto RULE_3_END
# Source line 4
# Second half of: RewriteRule ^/([0-9]+)/(.*)$ /index.php?uid/$1/$2 [L]
set URL = /index.php?uid/$1/$2
# This rule has [L]
goto END
RULE_3_END:

RULE_4_START:
match URL into $ with ^/([0-9]+)$
if not matched then goto RULE_4_END
# Source line 5
# Second half of: RewriteRule ^/([0-9]+)$ /index.php?uid/$1 [L]
set URL = /index.php?uid/$1
# This rule has [L]
goto END
RULE_4_END:

RULE_5_START:
match URL into $ with ^/action(.+)$
if not matched then goto RULE_5_END
# Source line 7
# Second half of: RewriteRule ^/action(.+)$ /index.php?action$1 [L]
set URL = /index.php?action$1
# This rule has [L]
goto END
RULE_5_END:

RULE_6_START:
match URL into $ with ^/category(.+)$
if not matched then goto RULE_6_END
# Source line 8
# Second half of: RewriteRule ^/category(.+)$ /index.php?action/category/catid$1 [L]
set URL = /index.php?action/category/catid$1
# This rule has [L]
goto END
RULE_6_END:

RULE_7_START:
match URL into $ with ^/viewnews(.+)$
if not matched then goto RULE_7_END
# Source line 9
# Second half of: RewriteRule ^/viewnews(.+)$ /index.php?action/viewnews/itemid$1 [L]
set URL = /index.php?action/viewnews/itemid$1
# This rule has [L]
goto END
RULE_7_END:

RULE_8_START:
match URL into $ with ^/viewthread(.+)$
if not matched then goto RULE_8_END
# Source line 10
# Second half of: RewriteRule ^/viewthread(.+)$ /index.php?action/viewthread/tid$1 [L]
set URL = /index.php?action/viewthread/tid$1
# This rule has [L]
goto END
RULE_8_END:

RULE_9_START:
match URL into $ with ^/mygroup(.+)$
if not matched then goto RULE_9_END
# Source line 11
# Second half of: RewriteRule ^/mygroup(.+)$ /index.php?action/mygroup/gid$1 [L]
set URL = /index.php?action/mygroup/gid$1
# This rule has [L]
goto END
RULE_9_END:

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



(C) 2001-2007 Comsenz Inc.