htaccess的重写多域 [英] htaccess rewrite multi domain
本文介绍了htaccess的重写多域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个2域的网站。
基本上,2域是我多语言的游客。我需要的是重写 domain1.com/en /
到 domain2.com
,这样用户就能够看到该网站的英文版,只需typeing的 domain2.com
在地址栏而不是 domain1.com/en /
。
任何提示?
Basically, the 2 domains are for my multilanguage visitors. What i need is to rewrite domain1.com/en/
to domain2.com
, so that user will be able to see the english version of the site by just typeing the domain2.com
in the address bar instead of domain1.com/en/
.
Any tips?
和BTW:我使用的PHP /阿帕奇..
and btw: i'm using php / apache..
编辑:两个域指向同一个托管帐户...
both domains point to the same hosting account...
TNX!
推荐答案
这些行添加到您的.htaccess文件在你的网站的根文件夹中。
Add these lines to your .htaccess file in the root folder of your website.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/en [L,R=301]
这篇关于htaccess的重写多域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文