Forum Moderators: phranque

Message Too Old, No Replies

Redirect everything but 1 html file

         

dfresh4130

8:23 pm on Apr 19, 2010 (gmt 0)

10+ Year Member



Ok, I'm sure this is simple and is already documented somewhere, but I can't find it for the life of me. I've got an HTTP listener set up and I need it to redirect everything to HTTPS except for a single keepalive.html file that the load balancer needs to get a 200 on. I've got the below redirect in httpd.conf, but I can't figure out how to tell it to rewrite everything except for keepalive.html. Any help is greatly appreciated.

RedirectPermanent / [abc123.com...]

g1smd

8:37 pm on Apr 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use RewriteRule instead of RedirectPermanent.

Add a RewriteCond testing the SERVER_PORT value.

There's a lot of prior examples here.

jdMorgan

1:00 pm on Apr 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need two RewriteConds, both using negative-match patterns. The first to prevent redirection if the SERVER_PORT is already 443, and the second to prevent redirection if the REQUEST_URI is keepalive.html.

If the non-SSL 'site' is in a separate vHost, then it is likely already qualified as being an HTTP (as opposed to HTTPS) request, so the SERVER_PORT test may not be needed.

Jim