SupSite/X-Space 启用Rewrite说明

来源:互联网 发布:开淘宝具备什么条件 编辑:程序博客网 时间:2024/06/14 18:48

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中是否存在如下两段代码:
LoadModulerewrite_module    libexec/mod_rewrite.so
AddModule mod_rewrite.c
Apache 2.x 的用户请检查 conf/httpd.conf中是否存在如下一段代码:
LoadModulerewrite_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服务器(针对ZeusV4.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:

-----------------------------------------------------------------------
体验新版博客