小东博客

网站强制https,搜索引擎自动http

修改.htaccess文件

判断UA并将搜索引擎定向到http,将一般访客定向到https

RewriteEngine On

# BEGIN Force SSL

RewriteCond %{HTTPS} !on [NC]
RewriteCond %{HTTP_USER_AGENT} !(baiduspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot) [NC]
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,NC,L]

# END Force SSL

码字很辛苦,转载请注明来自.小东博客 .《网站强制https,搜索引擎自动http 》