apache - 基于子域名的 http 到 https 重定向

标签 apache http ssl https

我们有 3 个指向 apache 网络服务器的子域,所有子域都用于不同的 Web 应用程序,我们有针对子域的 ssl,安装了 ssl 证书,但我们无法将 http 请求重定向到 https。 . 我们必须手动编写 https://subdomain.domain-name.com访问我们的应用程序...

我们使用的是 zend server 6。请帮助我们知道,以便所有 http 请求都可以重定向到 https。

我们已经把它写在我们的 httpd.conf 文件中了

    RewriteEngine On
     RewriteCond %{HTTP_HOST} ^(.*?)\.domain-name.com$
      RewriteCond %{HTTPS} !=on
        RewriteRule ^(.*?)$ https://%{HTTP_HOST} [nc]

我们对此很陌生。我们将不胜感激。

最佳答案

http://subdomain.domain-name.com 上创建 .htaccess 文件并将此代码放入其中

RewriteEngine On 
RewriteRule ^$ https://subdomain.domain-name.com [L,R=302]

关于apache - 基于子域名的 http 到 https 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20284451/

相关文章:

http - 如何在没有 HTTP 库的情况下发送 404 HTTP 响应?

javascript - 如何取消加载背景图片

ssl - 如何在 cPanel 中安装 SSL?

web-services - polyfill.io 的 CDN SSL 证书发生了什么?

amazon-web-services - Firebase 托管 : Connect with own AWS backend

php - 如何让 Nightwatch 测试在 CircleCI 中运行?

regex - 重定向除一个请求之外的所有请求

php - 使用 AFNetworking 上传 POST jpeg

java - 在 OpenCMS 网站上更改域名

apache - 强制 mediawiki squid 缓存填满所有页面