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

Is it necessary to add a canonical tag for a static site switching from HTTP to HTTPS if there is already a 301 Redirect?

· 52CE 我爱测

We have a static site that has thousands of HTML pages and are planning to switch to HTTPS in the next few days. As the site is fairly new, we do not have any problems with duplicate content at the moment, which is why we never a…

问题原文

原帖链接 · JAT86 · CC BY-SA 4.0

We have a static site that has thousands of HTML pages and are planning to switch to HTTPS in the next few days. As the site is fairly new, we do not have any problems with duplicate content at the moment, which is why we never added a rel="canonical" link tag on any of our pages.

Now, we want a permanent redirect for all of our site's pages from HTTP to HTTPS, and no longer want to have an insecure HTTP version. We want all old HTTP links to redirect to the HTTPS version. However, I am worried that Google might index the HTTPS version separately and leave the old HTTP version in the Search Results index thus creating duplicate content.

Is a 301 Redirect in the .htaccess file enough to prevent duplicate indexing by Google, or do we also need to add a canonical tag for each and every page? (we want to avoid adding canonical tags due to maintenance issues since our site is static)

已采纳解答

原帖链接 · Simon Hayter · CC BY-SA 4.0

No canonical links are not required if 301 redirects are working to the correct page(s), however, it should be noted that using canonical links is considered a best practice.

Canonical links are a great 'fall-back' should mod_rewrite behaviour become undesirable or stop working completely, this can often occur when upgrading Plesk, Cpanel or Apache. In short, I recommend that you use canonicals even when your pages are only accessible via a singular URL.

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

资料来源与适用范围

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

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

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