Warface
Warface

Reputation: 5119

Remove HTTPS if the url is a subdomain (.htaccess)

I would like to know how to add a condition that if the url is a subdomain, then ignore the "Force" https condition

Here the .htaccess that add the force HTTPS

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Upvotes: 1

Views: 617

Answers (2)

Get
Get

Reputation: 11

Try to add this before the last line

RewriteCond %{HTTP_HOST} ^(example\.com|www) [NC]

Upvotes: 0

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Try this RewriteCond in your htaccess

RewriteCond %{HTTP_HOST} ^www

Upvotes: 1

Related Questions