我有一个网站,其中所有连接都将被重定向(从http://
)到https://
。
这是我在.htaccess中的方式:
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L]
这很完美,但是......
Google网站管理员并不是非常喜欢它。它无法读取我的robots.txt。参见
所以我加入了.htaccess:
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^example\.com/robots\.txt [NC]
RewriteRule ^robots.txt$ http://example.com/robots.txt [NC,L]
但这不起作用(足够),因为网站管理员工具也将其标记为失败!
这些链接没有失败:
http://www.example.com/robots.txt
https://www.example.com/robots.txt
但这些失败了:
http://example.com/robots.txt
https://example.com/robots.txt
我现在尝试了2天!非常欢迎一些帮助。