w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Mod rewrite, redirect all to https except specific URI and redirect that URI from https to http

This should do it for you. Place the most specific rule (that for /example) first.

RewriteEngine on

RewriteCond %{HTTPS} =on
RewriteRule ^/?example$ http://my.site.com/example [R=301,L]

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/?example$
RewriteRule ^/?(.*)$ https://my.site.com/$1 [R=301,L]

This should work in either server (.conf) or directory (.htaccess) context.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.