httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <>
Subject Re: [users@httpd] URI / SSL help please
Date Mon, 07 May 2007 20:03:30 GMT
On 5/7/07, Ryan Huff <> wrote:
> I have this in my conf:
> RewriteEngine On
> RewriteCond %{HTTPS} off
> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
> Now that code chunk kicks all :80 traffic to https (:443) .... I need a
> rule that will also kick http://www. Over to https://
> If someone access the site by, I want it to goto
> https://%{HTTP_HOST}%{REQUEST_URI}

If you only have one site, this is easy:
RewriteCond %{HTTPS} off
RewriteRule ^/(.*)$1

If you want to be fancy and handle all domain names the same way:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.*) [NC]
RewriteRule ^/(.*) https://%2/$1

(I'm assuming you're doing this in httpd.conf. To do it in an
.htaccess would require a small adjustment.)


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