How to disable https redirect on a single page with htaccess
I am trying to disable https on a page on my site which also have a dynamic sub pages. For example http://example.com/page/dynamic/section:
You may use this .htaccess code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
RewriteEngine On # add www if missing to all the URIs RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] # turn on https except for a specific URI RewriteCond %{HTTPS} !on RewriteCond %{THE_REQUEST} !/page[/\s?] [NC] RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] # force http for a specific page: RewriteCond %{HTTPS} on RewriteRule ^page(/|$) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,NC] |