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.

1
  • What if you try this: RewriteCond %{HTTP_HOST) !=example.com
    – Diamond
    Dec 9, 2015 at 12:39

1 Answer 1

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
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .