# 何时应考虑使用 HTTP 301 重定向？

当您需要将 HTTP 80 协议的 URL 重定向到 HTTPS 443 协议的 URL 以增强网站安全性时，应考虑使用 HTTP 301 重定向。

### 前提条件

* 您已加速域名。
* 您已配置启用 HTTP 80 和 HTTPS 443 端口的加速规则。

如果您出于安全原因从 HTTP 转换到 HTTPS，使用 301 重定向可确保所有流量都被导向您网站的安全版本。它在安全性方面有以下几个重要作用：

1. **数据加密**：HTTPS 提供数据加密，确保用户浏览器和 Web 服务器之间交换的任何信息都是安全的。这对于保护敏感数据（如登录凭据、支付详情和个人信息）至关重要。
2. **数据完整性**：HTTPS 有助于在传输过程中维护数据的完整性。它通过确保用户接收到的数据与服务器发送的数据相同，防止未经授权的篡改或修改。
3. **身份验证**：HTTPS 通过 SSL/TLS 证书验证网站的身份。当用户在浏览器地址栏看到锁图标时，他们可以相信自己连接的是真正的网站，而不是冒名顶替者。
4. **防止中间人攻击**：使用 HTTPS 可降低中间人攻击的风险，这种攻击中恶意行为者会拦截并窃听用户与 Web 服务器之间的通信。
5. **搜索引擎排名**：像 Google 这样的主要搜索引擎会在搜索排名中优先考虑具有 HTTPS 的网站。安全的网站可以提高您网站的可见性和 SEO 表现。
6. **浏览器警告**：现代 Web 浏览器经常对不安全的 HTTP 网站显示警告，劝阻用户访问。301 重定向到 HTTPS 可帮助避免这些警告，提供更好的用户体验。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/cn/global-accelerator/faq/when-should-i-consider-using-http-301-redirect.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
