Re: [users@httpd] redirecting everything to ssl

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

 



Olaf van der Spek wrote:
On 11/30/05, Rob Benton <rob.benton@xxxxxxxxxxxxxx> 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@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