【发布时间】:2015-02-18 12:23:58
【问题描述】:
我负责运行一些常规网站和一些 SSL 网站的 Apache Web 服务器。所有这些网站均供公司内部使用。所有网站都使用 VirtualHost 指令。 所以我有
- http://siteA.mycompany
- http://siteB.mycompany
- http://siteC.mycompany
- https://siteD.mycompany
- https://siteE.mycompany
一切运行顺利,但有些用户向我抱怨他们无法访问这些网站,因为有时他们必须输入 http,有时他们必须输入 https ...(管理员的工作有时很辛苦)。
我正在寻找解决这项工作的方法:如果请求来自 http 协议,则必须重定向定义为使用 https 请求的网站。反向执行相同的工作(https 到 http)。
另一种解释我在寻找什么的方式:
* user request http://siteD.mycompany
* but website is define as using https protocol
* user's web browser change his request to https://siteD.mycompany
* user is no more bothered anymore by the bad protocol problem
有什么技巧/好的做法来做这样的工作吗? 由于这个“问题”引起了很多网站的关注,因此解决方案可能是通用的。
【问题讨论】:
-
用户访问
http://siteD.mycompany时会发生什么?另外,您可以为 siteD.mycompany 配置 VirtualHost 吗? -
@slash 当用户访问'siteD.mycompany'因为这个ServerName没有配置它会出错,它被“ErrorDocument 404”apache指令捕获,将他发送到自定义错误页面
标签: apache redirect https virtualhost