Since I declare it should only redirect if it is NOT an "https://" request, this code should not redirect from index.rd1.html to index.rd2.html if I type " https://example.com/index.rd1.html " in the url, but it does. Why?
RewriteEngine On
RewriteCond %{HTTPS} !on [NC]
RewriteCond %{REQUEST_URI} index.rd1.html [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/index.rd2.html [R=301,L]
It turns out that hostway.com (which is hosting the site) does not have the standard .htaccess rules. In order for it to detect https I had to add "ENV:" before HTTPS as done here:
RewriteCond %{ENV:HTTPS} !=on
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.