【问题标题】:Redirecting all subdomains to one page将所有子域重定向到一页
【发布时间】:2012-11-06 22:49:20
【问题描述】:

我正在尝试将 (http://*.domain.com) 的所有子域重定向到特定的 html 文件 (http://domain.com/index.html)。但我也希望可见的子域名不会改变。

我用 .htaccess 试过这个:

Options -MultiViews
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

#RewriteCond %{REQUEST_URI} !^/parent/ 
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$
RewriteRule (.*) /index.html [L]

但它根本不起作用。

谁能帮帮我?

【问题讨论】:

    标签: .htaccess redirect subdomain


    【解决方案1】:

    子域与目录有点不同。您需要有一个wildcard DNS record 才能捕获所有子域:

    *.example.com. 3600 IN  A host1.example.com.
    

    最好的办法是联系您的托管服务提供商。其中一些具有实现这一目标的设置。

    【讨论】:

    • 哦。我的托管服务提供商明确表示他们不支持通配符。还是谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-24
    • 2016-05-17
    • 2011-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多