Redirect site to HTTPS excluding a folder

On a web site, customer need to redirect all pages to HTTPS, but want to keep files in one of the folder on HTTP.

For this, i used following in .htaccess file.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/auth/.*
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Here any url like yourdomain.extn/auth/ will not get redirected to HTTPS.

See Redirect

Comments

Leave a Reply

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