Apache: Forcing SSL and Authentication

Nicholas Leippe nick at leippe.com
Tue Feb 13 16:26:07 MST 2007

On Tuesday 13 February 2007 16:13, Topher Fischer wrote:
> As far as I know, vhosts work with different host names, so I couldn't
> use a vhost configuration with this setup.  Is that correct?

vhost can be name based or ip based.
Regardless, you can also include :port as a qualifier and distinguish 
between :80 and :443 and have different <VirtualHost> blocks for each.

# You can do it with wildcards

NameVirtualHost *:80

<VirtualHost *:80>
  # and probably:
  <Directory <path>
    RedirectPermanent <path> http://machine/<path>

<VirtualHost *:443>

It can still be named based if by specifying a ServerName directive inside 
each VirtualHost.  The first wildcard VirtualHost becomes the default server 
settings used if no VirtualHost's ServerName is matched by the incoming 
request's Host header.

More information about the PLUG mailing list