小东博客
网站强制https,搜索引擎自动http
2015-4-21 小东


修改.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
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容