【发布时间】:2016-01-22 17:14:55
【问题描述】:
我希望我的网络服务器将所有 http 请求重定向到 https。 所以我设置了我的 .htaccess
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
重定向似乎有效,但是当我输入 _http://example.com/test/ 时,它会重定向到 _https://example.com/httpdocs/test/ ,这会产生 404 错误。 如果我直接访问_https://example.com/test/,一切正常!
【问题讨论】:
标签: apache .htaccess redirect https