Force HTTPS, easily
2004-09-21 13:24 - Tech
I recently set up a service monitoring package on my home server. By the way, it's Nagios which is hard to set up the first time, but a very powerful very cool program. This thing is available over the web, and I set up basic authentication to protect it. Problem is I wanted to encrypt the connection to protect my password.
I realized there's a very easy way to have Apache take any regular http request and tell the client to do https instead. It's as easy as:
<VirtualHost *:80> ServerName www.domain.com RewriteEngine On RewriteRule ^.*$ https://www.domain.com/ [R,L] </VirtualHost> <VirtualHost *:443> ServerName www.domain.com . . .
Me likey!