httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <jos...@slive.ca>
Subject Re: [users@httpd] URI / SSL help please
Date Mon, 07 May 2007 20:03:30 GMT
On 5/7/07, Ryan Huff <Ryan_Huff@knl.cc> 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 http://www.whatever.com, I want it to goto
> https://%{HTTP_HOST}%{REQUEST_URI}

If you only have one site, this is easy:
RewriteCond %{HTTPS} off
RewriteRule ^/(.*) https://example.com/$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.)

Joshua.

---------------------------------------------------------------------
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