我们有 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/