==== Force HTTPS/SSL on a website ====
__Using .htaccess__:
cd to directory you want to protect and edit .htaccess such as the following:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
-or-
SSLRequireSSL
then:
service httpd restart
----
__Using httpd.conf__:
Edit /etc/httpd/conf/httpd.conf such as the following:
# Force to use SSL
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [L,R]
Example:
# Force Nagios to use SSL
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/nagios(.*)$ https://%{HTTP_HOST}/nagios$1 [L,R]