我在http://rplstoday.com有一个网站 - WordPress安装在根目录中,xenForo安装在/ community。我有另一个域(http://beerleg.com)指向那里,但我希望一切都指向他们各自的rplstoday.com位置。那就是:
以下是我目前在root中的.htaccess所拥有的内容:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^beerleg.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.beerleg.com$
RewriteRule (.*)$ http://rplstoday.com/$1 [R=301,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
/ community中的默认xenForo .htaccess未受影响,如下所示:
<IfModule mod_rewrite.c>
RewriteEngine on
# If you are having problems with the rewrite rules, remove the "#" from the
# line that begins "RewriteBase" below. You will also have to change the path
# of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /community
# This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
但是,这是真正发生的事情:
如您所见,重写仅针对基本域,但不适用于任何内部URL。我缺乏知识(并且无法通过谷歌找到修复)让我感到难过。我非常感谢任何帮助!
答案 0 :(得分:1)
感谢xenForo支持团队提供的一些帮助,这就是我最终做的事情。
在根.htaccess文件中:
RewriteCond %{HTTP_HOST} ^beerleg.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.beerleg.com$
RewriteRule (.*)$ https://rplstoday.com/$1 [R=301,L]
在/ community .htaccess文件中:
RewriteCond %{HTTP_HOST} ^beerleg.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.beerleg.com$
RewriteRule (.*)$ https://rplstoday.com/community/$1 [R=301,L]
原来很简单。
答案 1 :(得分:0)
尝试一下:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*) http://www.rplstoday.com%{REQUEST_URI} [R=302,NC]
这应该使用完整路径重定向您的域。但是,您也可以尝试以下操作:
RewriteEngine on
RewriteBase /
RewriteRule (.*) http://www.rplstoday.com/$1 [R=301,L]