Reputation: 45
I currently have 3 domains on my cPanel account with HostGator. I am trying to force the main domain to use HTTPS, but all other domains to use HTTP. When I add the following to the main directories .htaccess file, it forces it upon all sub-directories too.
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Is there any way to not make it do this on the other domains?
Upvotes: 1
Views: 602
Reputation: 456
You just need another RewriteCond and check for the HTTP_HOST so that the RewriteRule is not applied to domains that don't need to have https:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^no-https-needed.example.com$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Upvotes: 1