博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

topshelley2008

要做就做最好的南瓜!
topshelley2008.cublog.cn


开启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
###      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]
 
-----------------------------------------------------------------------
 如果没有安装 mod_rewrite,您可以重新编译 Apache
并在原有 configure 的内容中加入 --enable-rewrite=shared
然后再在 Apache 配置文件中加入上述代码即可。
 进入系统设置,根据需要开启 URL 静态化 功能

发表于: 2007-10-25 ,修改于: 2007-10-25 10:57,已浏览236次,有评论0条 推荐 投诉


网友评论

发表评论