我想将 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 惩罚?
最佳答案
您将 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]
关于.htaccess - SSL 证书 & Htaccess & SEO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33698737/