[英]htaccess rewrite multi domain
i have a 2 domain website. 我有一个2域名网站。
Basically, the 2 domains are for my multilanguage visitors. 基本上,这2个域名适用于我的多语言访问者。 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/
. 我需要的是将domain1.com/en/
重写为domain2.com
,这样用户只需在地址栏中键入domain2.com
而不是domain1.com/en/
就能看到该网站的英文版本。 。 Any tips? 有小费吗?
and btw: i'm using php / apache.. 顺便说一下:我正在使用php / apache ..
EDIT:both domains point to the same hosting account... 编辑:两个域指向相同的主机帐户...
tnx! TNX!
Add these lines to your .htaccess file in the root folder of your website. 将这些行添加到您网站的根文件夹中的.htaccess文件中。
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/en [L,R=301]
I'm not sure you can use an .htaccess file for another domain. 我不确定您是否可以将.htaccess文件用于其他域。
I think you might need to play with the domain DNS settings. 我想你可能需要使用域DNS设置。
Or use an iFrame like in 1996 :D 或者像1996年一样使用iFrame:D
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.