移动vbseo的.htaccess规则至httpd.conf

以前一直在目录中使用.htaccess,近来老是发现apache的CPU占用率极高,于是参考朋友的建议,将VBSEO的规则写入httpd.conf,具体做法如下:

用EDITPLUS打开httpd.conf,一般在apache的conf目录中

添加如下:我们以”a.com”为例

<Directory “D:/htdocs/网站的ROOT目录名”>

# Comment the following line (add ‘#’ at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On

# Some servers require the Rewritebase directive to be
# enabled (remove ‘#’ at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.a\.com
RewriteRule (.*) http://www.a.com/$1 [L,R=301]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]
</Directory>

如果你的论坛是在子目录中,例如”a.com/forum”,规则中的路径要加上论坛子目录名即可

 VBSEO 3.6.0 RC1 下载地址:http://www.zhcn.org/download/?did=10

Tags:
shuxin

发表评论

电子邮件地址不会被公开。 必填项已用*标注