我想将ssl证书添加到我的新闻站点。但不想通过将http url改为https而得到SEO惩罚或seo排名下降。
我的htaccess文件现在是这样的:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]我打算这样改变它:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http**s**://www.%{HTTP_HOST}/$1 [R=301,L]同时,我会把所有的http url转换成html源代码中的https .
不受Google的惩罚是否足够?
发布于 2015-11-13 17:57:24
您可以将http url更改为https,但只有当url没有www时才会更改。
改为使用:
# Without IP
RewriteCond %{HTTP_HOST} ^[0-9.]+$
RewriteRule ^ - [L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]或者如果你把它和其他规则结合使用:
RewriteCond %{HTTP_HOST} !^(?:www\.|[0-9.]+$) [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTP_HOST} !^[0-9.]+$
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]https://stackoverflow.com/questions/33698737
复制相似问题