LINUXQQ

六月 20, 2008

APACHE支持静态化

类归于: 乱7八糟 — 标签: — admin @ 11:56 上午

APACHE支持静态化

Apache 2.x 的用户请检查 conf/httpd.conf 中是否存在如下一段代码:

LoadModule rewrite_module modules/mod_rewrite.so

如果存在,那么在配置文件(通常就是 conf/httpd.conf)中加入如下代码。此时请务必注意,如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置,即 <VirtualHost> 中去,如果加在虚拟主机配置外部将可能无法使用。改好后然后将 Apache 重启。
<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 配置文件中加入上述代码即可。

评论暂缺 »

还没有任何评论。

这篇文章上的评论 RSS feed TrackBack URL

留下评论

发表评论您必须先登录

WordPress 所驱动