0

I have a blanket redirect setup on the server like this:

<IfModule mod_rewrite.c>
            RewriteEngine On
            #redirect all port 80 traffic to 443
            RewriteCond %{HTTPS} off
            RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
</IfModule>

Now I would like to exclude one domain and I cant seem to work it out...

Here is what I tried:

    <IfModule mod_rewrite.c>
            RewriteEngine On
            #redirect all port 80 traffic to 443
            RewriteCond %{HTTPS} off
            RewriteCond %{HTTP_HOST) !example.com
            RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
    </IfModule>

However it still redirects http://example.com to https://example.com. What am I doing wrong?

PS. I tried in other browser so browser caching should not be an issue.

RandomWhiteTrash
  • 269
  • 1
  • 3
  • 17

1 Answers1

2

Seems like you have mispelled the configuration here (Notice the closing brace)

Replace

RewriteCond %{HTTP_HOST) !example.com

with this

RewriteCond %{HTTP_HOST} !example\.com
serverliving.com
  • 885
  • 7
  • 15