【问题标题】:.htaccess domain redirect.htaccess 域重定向
【发布时间】:2011-03-23 09:44:51
【问题描述】:

我有一个服务器,它有 3 个域都指向它。所有域都在同一个网站上。

www.domain1.com
www.domain2.com
www.domain3.com

如何使用 .htaccess 将 www.domain3.com 重定向到 www.domain3.com/test.html?

谢谢!

【问题讨论】:

  • 三个域是否共享同一个网站?还是他们在不同的网站上?
  • 是的,在同一个网站上。我正在使用 wordpress mu。

标签: .htaccess redirect dns


【解决方案1】:

在您的 .htaccess 中,输入:

RewriteEngine On
RewriteCond %{http_host} ^www\.domain3\.com [NC]
RewriteRule ^(.*)$ http://www.domain3.com/test.html [R=301,NC]

应该可以的。

【讨论】:

    【解决方案2】:

    在您的domain3 的.htaccess 中,输入:

    RedirectPermanent / http://www.domain2.com/test.html
    

    【讨论】:

    • 感谢您。但我的问题错了。请参阅编辑版本。谢谢!
    猜你喜欢
    • 2012-05-07
    • 2019-10-13
    • 2020-07-26
    • 2017-03-17
    • 2014-12-24
    • 2012-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多