重定向不改变网址 [英] redirecting without changing URL

查看:387
本文介绍了重定向不改变网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重定向域名domain1.com到domain2.com完全,但不改变domain1.com URL。 我想我能做到这一点的。htaccess的,但我发现,这是不可能的,因为它们是不同的领域,我应该使用http://在.htaccess规则,所以这将是一个外部重写不是内部重写,所以URL会改变。

i want to redirect domain domain1.com to domain2.com completely but without changing domain1.com URL. i thought i could do that with .htaccess but i found out that it is not possible because they are to different domains and i should use http:// in .htaccess rule so it would be an external rewriting not an internal rewriting,so the URL will change.

还有没有其他的解决办法?使用iframe中唯一的解决办法? 我要补充一点,我不想改变DNS设置这两个领域。

is there any other solution? is using iframe the only solution? i have to add that i don't want to change DNS setting for these 2 domains.

推荐答案

如果这两个域在同一台服务器指向,那么你可以设置你的Apache配置在同一文档根目录指向这两个领域。

If both domains point at the same server then you can setup your apache config to point both domains at the same document root.

NameVirtualHost *

<VirtualHost *>
ServerName domain1.com
DocumentRoot /www/mysite
</VirtualHost>

<VirtualHost *>
ServerName domain2.com
DocumentRoot /www/mysite
</VirtualHost>

不过,我会建议domain2.com重定向(302重定向中的.htaccess),因为它会提高你的搜索引擎优化,这两个网站将被视为之一。因此,如果Googlebot会发现domain2.com在其他网站的链接,将其添加为的PageRank来domain1.com。

However, I would recommend domain2.com redirects (with a 302 redirect in the .htaccess) because it will improve your search engine optimisation, as both sites will be considered as one. So if a GoogleBot finds domain2.com as a link in another site, it will add it as a pagerank to domain1.com.

这篇关于重定向不改变网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆