Options -Indexes
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule ^(.*)$ [
mysite.com...] [R=301,L]
#Redirect the pages below to html and it must be in SSL
RewriteCond %{HTTPS} =on
RewriteRule ^contactus\.html$ contactus.php
RewriteRule ^login\.html$ user_login.php
RewriteRule ^registration\.html$ user-registration.php
RewriteRule ^logout\.html$ logout.php
#Redirect the pages below to https if requested via http
RewriteCond %{HTTPS} !=on
RewriteRule ^contactus\.html$ [
mysite.com...] [NC,R=301,L]
RewriteRule ^login\.html$ [
mysite.com...] [NC,R=301,L]
RewriteRule ^registration\.html$ [
mysite.com...] [NC,R=301,L]
RewriteRule ^logout\.html$ [
mysite.com...] [NC,R=301,L]
RewriteRule ^site-tradeshow\.html$ tradeshow.php
RewriteRule ^site-aboutus\.html$ tradeshow.php
# Redirect non-canonical hostname requests to canonical domain
RewriteCond %{HTTP_HOST} !=www.mysite.com
RewriteCond %{HTTPS}>s ^(on>(s)|[^>]+>s)$
RewriteRule ^(.*)$ http%2://www.mysite.com/$1 [R=301,L]
Sorry, im really new to htaccess I can't figure why this code isn't working. Basically, I want contactus, login, registration, logout pages to be in https. If the url is requested via http make it https.
Then tradeshow and aboutus should not be in https. If its requested via https: make it http. Why is my code isn't working? Any idea, please?