SSL 证书 & Htaccess & SEO

SSL Ceriticate & Htaccess & SEO

我想将 ssl 证书添加到我的新闻站点。但是不想通过将 http url 更改为 https..

来获得 SEO 惩罚或 seo 排名降低

我的 htaccess 文件现在是这样的:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/ [R=301,L]

我打算这样改:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http**s**://www.%{HTTP_HOST}/ [R=301,L]

此外,我会将 html 源中的所有 http url 转换为 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]