0

我有两个 .htaccess ,第一个 .htaccess 位于根目录中,即www文件夹,第二个 .htaccess 位于名为forum的文件夹中

www 文件夹中的 .htaccess 代码不能与论坛文件夹中的 .htaccess 代码一起使用

我正在研究的是如何将两个 htaccess 合并到根目录 www

www 目录中的 .htaccess

Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.site\.com$
RewriteRule ^/?$ "http\:\/\/www\.site\.net\/" [R=301,L]

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

.htaccess 在论坛目录中

#RewriteEngine On
RewriteRule ^site-t(.*).html showthread.php?t=$1 [L]
RewriteRule ^site-f(.*) forumdisplay.php?f=$1 [L]
RewriteRule ^f(.*)-(.*).html forumdisplay.php?f=$1 [L]
RewriteRule ^site-u(.*).html member.php?u=$1 [L]
RewriteRule ^index.php$ http://%{http_host}/ [R=301,L
RewriteRule ^t(.*).html showthread.php?t=$1 [L] 
RewriteRule ^f(.*).html forumdisplay.php?f=$1 [L] 
RewriteRule ^post(.*)-(.*) showpost.php?p=$1&postcount=$2 [L]
RewriteRule ^u(.*).html member.php?u=$1 [L]
RewriteRule archive/t-(.*) archive/index.php/t-$1 [L]
RewriteRule tags/(.*).html tags.php?tag=$1 [L]



RewriteEngine on

# This file is only needed if you have set the Forum Component URL in your admincp and you are 
# using the mod_rewrite option for friendly urls.  If this is the case, copy this file
# to your forum component stub directory.

# If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your forum component directory.
# RewriteBase /forum-stub-directory/

# If you are having problems with the rewrite from content/ to content.php, uncomment this line to turn MultiViews off.
# Options -MultiViews

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
##################################################
RewriteEngine on
RewriteRule ^f.txt vbmaps.php?cat=d [L]
RewriteRule ^t([0-9]+).txt vbmaps.php?rss=d&page=$1 [L]
RewriteRule ^tag([0-9]+).txt maptag.php?rss=d&page=$1 [L]
RewriteRule ^t([0-9]+).txt vbmaps.php?rss=d&page=$1 [L]
RewriteRule ^tag([0-9]+).txt maptag.php?rss=d&page=$1 [L]
RewriteRule ^forums maps.php?cat=d [L]
RewriteRule ^thread([0-9]+) maps.php?rss=d&page=$1 [L]
RewriteRule ^forums.xml maps.php?cat=d 
RewriteRule ^thread([0-9]+).xml maps.php?rss=d&page=$1 [L]
RewriteRule ^t([0-9]+)\-([0-9]+)\.html$     showthread.php?t=$1&page=$2     [L]
RewriteRule ^f([0-9]+)\-([0-9]+)\.html$     forumdisplay.php?f=$1&page=$2   [L]
RewriteRule ^post([0-9]+)\.html$        showthread.php?p=$1#post$2  [L]
RewriteRule ^t(.*).html showthread.php?t=$1 [L]
RewriteRule ^u(.*).html member.php?u=$1 [L]
RewriteRule ^f(.*).html forumdisplay.php?f=$1 [L]
RewriteRule ^f(.*)-t(.*) showthread.php?t=$1 [L]
RewriteRule ^t([0-9]+)\-([0-9]+)$   showthread.php?t=$1&page=$2     [L]
RewriteRule ^f([0-9]+)\-([0-9]+)$   forumdisplay.php?f=$1&page=$2   [L]
RewriteRule ^post([0-9]+)$      showthread.php?p=$1#post$2  [L]
RewriteRule ^t([0-9]+)$         showthread.php?t=$1 [L]
RewriteRule ^u([0-9]+)$         member.php?u=$1 [L]
RewriteRule ^f([0-9]+)$         forumdisplay.php?f=$1 [L]
RewriteRule ^t([0-9]+)\-([0-9]+)$   showthread.php?t=$1&page=$2     [L]
RewriteRule ^f([0-9]+)\-([0-9]+)$   forumdisplay.php?f=$1&page=$2   [L]
RewriteRule ^post([0-9]+)$      showthread.php?p=$1#post$2  [L]
RewriteRule ^t([0-9]+)$         showthread.php?t=$1 [L]
RewriteRule ^u([0-9]+)$         member.php?u=$1 [L]
RewriteRule ^f([0-9]+)$         forumdisplay.php?f=$1 [L]
RewriteEngine On
RewriteRule ^t(.*).html showthread.php?t=$1 [L]
RewriteRule ^f(.*).html forumdisplay.php?f=$1 [L]
RewriteRule ^u(.*).html member.php?u=$1 [L]
RewriteRule ^(.*)-post(.*).html showpost.php?p=$1&postcount=$2 [L]
RedirectMatch 301 thread(.*).html$ http://www.site.net/vb/showthread.php?t=$1


#########################################################
RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbulletin_sitemap_index.xml.gz [L]
4

0 回答 0