我想通过IP和域访问我的网站,但我不想让谷歌索引IP.以谷歌为例,我可以通过Doamin https://www.google.com/
和IP http://202.166.193.159/
访问谷歌。我厌倦了 301 重定向 HTaccess,
RewriteEngine On
RewriteCond %{HTTP_HOST} ^202'.166'.193'.159$
RewriteRule ^(.*)$ https://www.google.com/$1 [L,R=301]
这并没有给我解决方案。我想通过两者访问,但不想通过 ip 索引
谢谢!
您可以使用
根.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]