【问题标题】:How to redirect a subdomain to another subdomain using htaccess如何使用 htaccess 将子域重定向到另一个子域
【发布时间】:2014-03-16 03:24:53
【问题描述】:

我想将一个子域重定向到不在同一个域中的另一个子域。

例子:

subdomain.mydomain.com --> subdomain.myotherdomain.com

我尝试了以下代码:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.domain\.com$ [NC]
RewriteRule ^(.*)$ http://subdomain.myotherdomain.com [R=301,L]

RewriteCond 似乎不起作用...

你们能帮帮我吗?

谢谢, 达米安

【问题讨论】:

  • 在这些情况下没有错。 .htaccess 可能未启用。

标签: .htaccess mod-rewrite redirect subdomain


【解决方案1】:

在您的子域根 htaccess 中尝试这种方式。

RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain [NC]
RewriteRule ^(.*)$ http://subdomain.myotherdomain.com [R=301,L]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-26
    • 2013-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-25
    • 1970-01-01
    相关资源
    最近更新 更多