-1

I have a RHEL6.4 httpd VirtualHost that I want to use to forward inbound traffic like so:

Any incorrect host names in requests will redirected correctly to my SERVER_NAME

AND

Any non-port-443 traffic will be redirected to https:// correctly

By correctly, I meant that any part of the URL submitted after the hostname will be preserved. Any help?

1 Answers1

1

First, define your correct https vhost:

<VirtualHost *:443>
    ServerName  whatever.example.com
    # everything else
</VirtualHost>

Now define your HTTP to HTTP redirect:

<VirtualHost *:80>
    ServerName  whatever.example.com
    Redirect permanent / https://whatever.example.com
</VirtualHost>

And now, define a catchall host for redirecting the incorrect ones:

<VirtualHost *:80>
    ServerName  catchall.example.com
    ServerAlias *
    Redirect permanent / https://whatever.example.com
</VirtualHost>

Redirect will preserve your parameters and paths.

zhenech
  • 1,492
  • 9
  • 13
  • This seems to be what the OP is asking for. She might want to read up on SNI and in mod_rewrite about specific business rules that need to be applied – Martin M. Nov 10 '13 at 12:59