httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Mearns <>
Subject Re: [users@httpd] http to https
Date Sat, 21 Mar 2009 14:00:19 GMT
On Sat, Mar 21, 2009 at 4:52 AM, Davide Bianchi
<> wrote:
> Tim DeBoer wrote:
>> For example if I type in <>, I want
>> apache to read/load it as in my browser.
> What you need is to setup an http site '' that
> automatically redirect to the https site.
> Somethig like
> <VirtualHost *:80>
>        Servername
>        RedirectPermanent /
> </VirtualHost>
> Davide
> --
> I have replaced NT with Linux.
> Linux -- heir of the byte that dogged me.
>   -- Allan Willis

You can do it with a rewrite rule, too, your is just wrong. First, the
pattern in your rule is . which will match any one character, so it
will only match requests with a single character in the path. To match
anything, you want "^(.*)$", then you want to put "$1" at the end of
your rewrite substitution, so that the path they requested gets
appended to the rewritten request.

Second, you want to do a full redirect, not just a rewrite. Rewriting
is internal only and won't cause the client to connect securely. To
turn the rewrite rule into a redirect, add the [R] flag. If this is a
permanent set up, you should make it [R=301].

Finally, the way you have it set up, this will probably cause an
infinite redirect because you haven't filtered out requests that are
already https. Check the RewriteCond documentation, there's some way
to check this. You only want to apply your rewrite if it isn't already

Anyway, Davide's suggestion is probably simpler.


Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from:

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message