【问题标题】:Remove Plesk preview domain redirect删除 Plesk 预览域重定向
【发布时间】:2014-05-28 08:09:36
【问题描述】:

Plesk 为您提供了一种在切换 DNS 之前预览站点的便捷方式,称为Websites Preview

这就是它的作用:

customer-site.tld 将作为 customer-site.tld.192-0-2-12.your-domain.tld 提供预览。这里的 192-0-2-12 是站点的 IP,其中的点替换为破折号

我发现这个功能非常有用,因为我们在网站上线之前使用它来校对网站,但是在网站上线之后,customer-site.tld.192-0-2-12.your-domain.tld URL 仍然存在,并且会显示在一些 Google 搜索结果中!

如何仅删除某些网站的预览 URL,而不是服务器上的所有网站?

或者,我认为我可以为此使用 .htaccess 规则,但如果没有重定向循环,我无法弄清楚如何做到这一点。

【问题讨论】:

    标签: .htaccess redirect plesk


    【解决方案1】:

    我通过更多搜索找到了答案(我搜索了如何重定向域别名,因为这本质上就是这样)。

    答案在这里:Redirecting all domain aliases to one with htaccess

    RewriteEngine On
    # If the hostname is NOT www.domain.com
    RewriteCond %{HTTP_HOST} !^www\.domain\.com$
    # 301 redirect to the same resource on www.domain.com
    RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
    

    【讨论】:

    • 如果网站不是www,请记住删除“www”,以防止重定向循环。
    【解决方案2】:

    使用robots.txt 文件防止抓取工具将您的网页编入索引。完成 DNS 切换后,删除 robots.txt 文件

    【讨论】:

    • 我不能使用 robots.txt,因为这是域的别名,而不是单独的主机。
    猜你喜欢
    • 2020-04-28
    • 2015-12-12
    • 1970-01-01
    • 2014-05-16
    • 1970-01-01
    • 2018-10-03
    • 2017-12-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多