http - Nginx (1.2.7) 将 HTTP 重定向到 HTTPS

标签 http redirect ssl nginx https

在我的服务器上安装了http Nginx version: 1.2.7

今天我打开了 SSL。

但我有一个大问题,我不知道如何设置绝对所有子页面永久转移到:https://example.com

所以我想要这一切:

  • http://example.com
  • http://www.example.com

被重定向到 https://example.com

  • http://www.example.com/test.pdf 被重定向到 https://example.com/test.pdf

喜欢所有子页面(我有 500 个子页面 200 html – 300 pdf)。

在我的 https 上安装了 Apache。

还有如何配置一切,因为我的知识很少。

最佳答案

试试这个:返回 301 https://example.com $request_uri;

关于http - Nginx (1.2.7) 将 HTTP 重定向到 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25364755/

相关文章:

rest - 可以在 POST 中返回 http 状态 404 吗?

redirect - OnePage Checkout 上的 Magento 奇怪的重定向行为

python - 使用 Python 请求的重定向错误太多

javascript - 无法使用 loopbackjs 验证 nodejs 中的第一个证书

ios - iOS 上的 Safari 是否拒绝下载 `application/octet-stream` 内容?

ruby-on-rails - Rails 3.2 `link_to`(在电子邮件中) `method: :put` 仍在生成 GET 请求

javascript - 为什么我的 iFrame 重定向到其他页面

ssl - 握手失败: SSL Alert number 40

apache - AH00016 : Configuration Failed

AngularJS:链接 promise 忽略拒绝