Re: URI / SSL help please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/7/07, Ryan Huff <Ryan_Huff@xxxxxx> 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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux