I'm trying to rewrite URLs from domain_a.de to domain_b.de/$1
我正在尝试将domain_a.de中的URL重写为domain_b.de/$1
More specifically, I want the browser to keep showing domain_a plus keep hash tags after the domain itself:
更具体地说,我希望浏览器继续显示domain_a以及在域本身之后保留哈希标记:
e.g. domain_a.de/#events ---> domain_b.de/#events
例如domain_a.de/#events ---> domain_b.de/#events
I'm trying the following code:
我正在尝试以下代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain_a.de/$1
RewriteRule ^(.*) http://domain_b.de/$1 [P]
</IfModule>
I thought this should do the trick. But instead, I keep getting:
我认为这应该可以解决问题。但相反,我一直在:
"Forbidden - You don't have permission to access / on this server."
Is there something wrong with my .htaccess or could it be that the server doesn't even support mod_rewrite?
我的.htaccess有问题,还是服务器甚至不支持mod_rewrite?
1 个解决方案
#1
Have to answer this myself:
必须自己回答:
The problem actually only occurred when browsing www.doman_a.de.
问题实际上只发生在浏览www.doman_a.de时。
After adding
RewriteCond %{HTTP_HOST} ^www.domain_a.de/$1
RewriteRule ^(.*) http://domain_b.de/$1 [P]
for redirecting visitors for www.* everything worked fine.
为了重定向访问者www。*一切正常。
#1
Have to answer this myself:
必须自己回答:
The problem actually only occurred when browsing www.doman_a.de.
问题实际上只发生在浏览www.doman_a.de时。
After adding
RewriteCond %{HTTP_HOST} ^www.domain_a.de/$1
RewriteRule ^(.*) http://domain_b.de/$1 [P]
for redirecting visitors for www.* everything worked fine.
为了重定向访问者www。*一切正常。