I am facing URL rewriting problem using .htaccess.
I have to redirect all the URLs to HTTPS except 4 URLs. Below is the code in my .htaccess file:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_REFERER} !^https(.*)/(.*)$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{REQUEST_URI} ^/?index\.php$ [NC]
RewriteCond %{REQUEST_URI} ^/?index\.php?view=default [NC]
RewriteCond %{REQUEST_URI} ^/?index\.php?view=news [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301, NC, L]
# Require SSL on all other pages
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}r%{REQUEST_URI} [R=301, NC, L]
I need to disable HTTPS for following URLs:
mydomain.com/
mydomain.com/index.php
mydomain.com/index.php?view=new
mydomain.com/index.php?view=new&abc=xyz&aaa=bbb…
mydomain.com/index.php?view=default
For above 5 URLs, I want to redirect in http, but it does not work. It redirects all the URLs to HTTPS only.