Here's another way:
RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
-- RewriteEngine on RewriteCond %{REQUEST_URI} /login/* [NC] RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
-- RewriteEngine on RewriteCond %{HTTP_HOST} foo.bar.com [NC] RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
There's lots of other ways as well.
Regards,
Pen
On Thu, 2006-04-06 at 22:23 -0500, phil wrote:
On Thu, 6 Apr 2006 08:56:40 -0700, Ethan Erchinger ethan@plaxo.com wrote:
RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
-- RewriteEngine on RewriteCond %{REQUEST_URI} /login/* [NC] RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
-- RewriteEngine on RewriteCond %{HTTP_HOST} foo.bar.com [NC] RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L] RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
-- RewriteEngine on RewriteCond %{REQUEST_URI} /login/* [NC] RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
-- RewriteEngine on RewriteCond %{HTTP_HOST} foo.bar.com [NC] RewriteRule ^(.*) https://%%7BSERVER_NAME%7D$1 [R,L]
There's lots of other ways as well.
Regarsd,
There's lots of other ways as well.
Regarsd,
On Apr 6, 2006, at 7:37 AM, Corrado 'Fizban' Ignoti wrote:
On Thu, 6 Apr 2006 10:19:04 -0500, phil phil@cryer.us wrote:
You need to have that mod_rewrite vodoo running on Apache for this to work, but work it does.
I'm wondering about IIS users. Is there a thing similar to mod_rewrite to force https connections?
Another approach is to not use mod_rewrite to enforce https. I simply setup two virtual servers, one on 80 and one on 443, then redirect any request from http -> https. As such:
NameVirtualHost 192.168.2.1:80 NameVirtualHost 192.168.2.1:443
# Redirect webmail requests to ssl <VirtualHost 192.168.2.1:80> ServerName webmail.myhost.org RedirectPermanent / https://webmail.myhost.org/
</VirtualHost>
# Serve webmail requests <VirtualHost 192.168.2.1:443> SSLEngine on ServerName webmail.myhost.org ...
</VirtualHost> ---------------------------------------
That's a good solution too - however if you're running websites on your server you likely won't want them all to be servered up via SSL - and I assume this setup would only allow HTTPS for all on :80?
P