【问题标题】:i want to access my website by ip and domain but want to google indexing ip我想通过 ip 和域访问我的网站,但想用谷歌索引 ip
【发布时间】:2015-03-05 04:36:35
【问题描述】:

我想通过 ip 和域访问我的网站,但我不希望谷歌索引 ip。以谷歌为例,我可以通过域名https://www.google.com/和iphttp://202.166.193.159/访问谷歌。 通过这样做,我厌倦了 htaccess 中的 301 重定向

RewriteEngine On
RewriteCond %{HTTP_HOST} ^202\.166\.193\.159$
RewriteRule ^(.*)$ https://www.google.com/$1 [L,R=301]

这并没有给我解决方案。我想同时访问,但不想通过 ip 进行索引

谢谢!

【问题讨论】:

    标签: php apache .htaccess seo


    【解决方案1】:

    您可以使用 root .htaccess 为 Googlebot 重定向:

    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} ^googlebot
    # With your IP !
    RewriteCond %{HTTP_HOST} ^202\.166\.193\.159$
    # With your domain !
    RewriteRule ^ https://www.google.com%{REQUEST_URI} [L,R=301,NE]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-10
      • 2015-05-06
      • 2015-10-07
      • 2011-09-05
      • 1970-01-01
      • 2014-02-24
      • 2018-01-25
      • 2021-03-03
      相关资源
      最近更新 更多