Rewrite to https

If you want to rewrite a URL to https in the same virtualhost that you run http, you can add the flag RewriteCond %{HTTPS} !=on, like this:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(/test)$ https://%{SERVER_NAME}$1 [R,L]

Leave a Reply

Your email address will not be published. Required fields are marked *