httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Benton <rob.ben...@conwaycorp.net>
Subject Re: [users@httpd] redirecting everything to ssl
Date Thu, 01 Dec 2005 18:38:21 GMT
Olaf van der Spek wrote:
> On 11/30/05, Rob Benton <rob.benton@conwaycorp.net> wrote:
> 
>>I've got a site on my intranet running with mod_ssl.  This site used to
>>run over plain http://.  I'd like to redirect everyone trying to access
>>the old address to the new address via https://.
>>
>>I tried just:
>>Redirect permanent http://site https://site
>>
>>but I get a 400 Bad Request error.  I also looked at mod_rewrite but
>>wasn't sure if it would work for this.  What is the
>>simplest/best/easiest way to do this?
> 
> 
> I use:
>         RewriteEngine on
>         RewriteCond %{HTTP_HOST} !^xwis.net [NC]
>         RewriteRule ^/(.*)       http://xwis.net/$1 [l,r=permanent]
> 
> You would not use the Cond and use https in the Rule.

Just trying that gives me the infinite redirect loop.  So I tried 
this(lifted from URL Rewriting Guide):

RewriteCond %{HTTP_HOST}   !^my\.site [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{SERVER_PORT} ^(80|443)$
RewriteRule ^/(.*)         https://my.site/$1 [L,R]

That will direct all https:// traffic to the right hostname but trying 
to use http:// still results in the bad request error:

"Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please."

I must have missed something else in the config file.  I have 2 Listen 
directives, 1 for 80, and 1 for 443.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message