Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add a recipe for catch-all vhosts

...

Let's say you want http://www.example.com/secure/ to always be sent over SSL (I presume here that both the normal and the SSL vhost have the same content). You could do this by linking to the correct page from within your HTML pages... but there will always be some user who will sneak by it that way.

Table of Contents

...

Using virtual hosts (using redirect)

...

No Format
   Redirect permanent / https://secure.example.com/

Using a catch-all vhost (dynamic Host: header)

When the requested Host: header is unknown ahead of time, we can use the following trick to build the target URL dynamically. Using Location instead of LocationMatch avoid the overhead of PCRE.

Advanced Tables - Table Plus

<Location />

  Redirect permanent / "https://%{HTTP_HOST}/"

</Location>

Using .htaccess files and redirect

...