大网数据广告活动
网站运营与故障问答

How to set preferred domain with https in Google Webmaster Tools

· 52CE 我爱测

I have registered a website and bought an SSL certificate, installed it and did some mod_rewrite rules to have all my traffic go to https://example.com . So all is working nicely from that perspective. I also went to Google Searc…

问题原文

原帖链接 · BlackSky86 · CC BY-SA 3.0

I have registered a website and bought an SSL certificate, installed it and did some mod_rewrite rules to have all my traffic go to https://example.com. So all is working nicely from that perspective.

I also went to Google Search Console and added/verified all the www, non-www and https, https://www sites. But when I go to preferred domain, I don't see the option for https. So I just decided to go with the example.com one. Is there anything I need to do? Do I need to add 301 redirects? Or how do I check I did it right?

已采纳解答

原帖链接 · BlackSky86 · CC BY-SA 3.0

as @w3dk mention in the comments, I had to add a R=301 in my .htaccess file. RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L] </IfModule> I didn't try Goyllo's answer but I think it's a good one if you don't have access to the server.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。