我试图设置一个htaccess规则,将特定网址下的所有网页重定向到https,当前默认为http。
我试图在/ enrollments / page之后设置包含任何内容的整体规则。
由于包含多个位置且添加了更多位置,因此我不希望每次添加新子页面时都为特定页面添加新规则。
主要:http://www.domain.com/enrolments/
SUB:http://www.domain.com/enrolments/uk
SUB:http://www.domain.com/enrolments/USA
是否有人在注册页面和任何生成的子页面上设置https的方法。
干杯
答案 0 :(得分:0)
您可以使用以下代码:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
希望这会有所帮助:)
答案 1 :(得分:0)
# HTTPS page Redirects
RewriteEngine On
# This will enable the Rewrite capabilities
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS
RewriteRule ^/?enrolments/(.*) https://%{SERVER_NAME}/enrolments/$1 [R,L]
#END https redirects