I perhaps just need some extra insight because I don't see where I'm going wrong. I used an SSL Cert to secure our nagios server. We want to specifically require all traffic over nagios (like 2 users, lol) to use SSL.
So I thought, oh, mod_rewrite + Rewrite Rule in .htaccess, right?
So I went into the DocumentRoot and did a vi .htaccess (one didn't already exist) and then I put in the following rule;
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://our.server.org/$1 [R,L]
This does absolutely nothing. Does nada.
Whhhyy..
Note: AllowOverride all in httpd.conf is on. Also, I verified that the module is not uncommented out ... but note, I couldn't find the mod_rewrite module installed so I copied it over from another server and placed it in modules/mod_rewrite.so . It was weird because it was enabled in the httpd.conf file, but then didn't exist in modules ...
I'm a baddie :(
Here's my redirecting non-ssl VirtualHost in its entirety:
This belongs in the Apache config rather than in
.htaccess
.The main difference is in our
RewriteCond
lines, where yours is%{SERVER_PORT} 80
and mine is%{HTTPS} !=on
.It's much easier to do the following if you have two different vhost entries setup.
In the non-ssl vhost. Don't worry that will cover all uris entered.