+ 您可以通过系统设置中“是否开启伪静态”来控制 URL 静态化 开启关闭状态
+ 本功能对服务器环境有特殊要求,独立主机用户需要对 Web 服务器增加相应的 Rewrite 规则,因此需要服务器权限才可使用。对于虚拟主机用户,您需要向您的空间服务商进行咨询:空间是否支持 Rewrite 以及是否支持对站点目录中 .htaccess 的文件解析,只有满足这两条件,URL 静态化 功能才会生效。
+++++++++++++++++++++++++
Apache Web Server(Apache 用户)
+++++++++++++++++++++++++
首先确定您使用的 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)中加入如下代码。此时请务必注意,如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置,即 <VirtualHost> 中去,如果加在虚拟主机配置外部将可能无法使用。改好后然后将 Apache 重启。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^info-id-([0-9]+)\/$ public/info.php?id=$1
RewriteRule ^info-catid-([0-9]+)-page-([0-9]+)\/$ public/info.php?catid=$1&page=$2
RewriteRule ^info-catid-([0-9]+)-areaid-([0-9]+)-page-([0-9]+)\/$ public/info.php?catid=$1&areaid=$2&page=$3
RewriteRule ^aboutus\/$ public/about.php?part=aboutus
RewriteRule ^aboutus-id-([0-9]+)\/$ public/about.php?part=aboutus&id=$1
RewriteRule ^announce-page-([0-9]+)\/$ public/about.php?part=announce&page=$1
RewriteRule ^announce-id-([0-9]+)\/$ public/about.php?part=announce&id=$1
RewriteRule ^faq\/$ public/about.php?part=faq
RewriteRule ^faq-id-([0-9]+)\/$ public/about.php?part=faq&id=$1
RewriteRule ^friendlink\/$ public/about.php?part=friendlink
RewriteRule ^friendlink-action-apply\/$ public/about.php?part=friendlink&action=apply
RewriteRule ^guestbook-page-([0-9]+)\/$ public/about.php?part=guestbook&page=$1
RewriteRule ^guestbook-action-write\/$ public/about.php?part=guestbook&action=write
RewriteRule ^space-([a-z,0-9\-]+)\/$ public/space.php?user=$1
</IfModule>
++++++++++++++++++++++
IIS Web Server(IIS 用户)
++++++++++++++++++++++
首先在 IIS 的 Isapi 上添加IIS_Rewrite这个筛选器,筛选器名称为 Rewrite ,可执行文件选择 Rewrite.dll ,重新启动 IIS。IIS_Rewrite目录中 httpd.ini 已经设置好,其中内容如下:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/info-id-([0-9]+)\/\?*(.*)$ $1/public/info\.php?id=$2
RewriteRule ^(.*)/info-catid-([0-9]+)-page-([0-9]+)\/\?*(.*)$ $1/public/info\.php?catid=$2&page=$3
RewriteRule ^(.*)/info-catid-([0-9]+)-areaid-([0-9]+)-page-([0-9]+)\/\?*(.*)$ $1/public/info\.php?catid=$2&areaid=$3&page=$4
RewriteRule ^(.*)/aboutus\/\?*(.*)$ $1/public/about\.php?part=aboutus
RewriteRule ^(.*)/aboutus-id-([0-9]+)\/\?*(.*)$ $1/public/about\.php?part=aboutus&id=$2
RewriteRule ^(.*)/announce-page-([0-9]+)\/\?*(.*)$ $1/public/about\.php?part=announce&page=$2
RewriteRule ^(.*)/announce-id-([0-9]+)\/\?*(.*)$ $1/public/about\.php?part=announce&id=$2
RewriteRule ^(.*)/faq\/\?*(.*)$ $1/public/about\.php?part=faq
RewriteRule ^(.*)/faq-id-([0-9]+)\/\?*(.*)$ $1/public/about\.php?part=faq&id=$2
RewriteRule ^(.*)/friendlink\/\?*(.*)$ $1/public/about\.php?part=friendlink
RewriteRule ^(.*)/friendlink-action-apply\/\?*(.*)$ $1/public/about\.php?part=friendlink&action=apply
RewriteRule ^(.*)/guestbook-page-([0-9]+)\/\?*(.*)$ $1/public/about\.php?part=guestbook&page=$2
RewriteRule ^(.*)/guestbook-action-write\/\?*(.*)$ $1/public/about\.php?part=guestbook&action=write
RewriteRule ^(.*)/space-([a-z,0-9\-]+)\/\?*(.*)$ $1/public/space\.php?user=$2