I have 2 LAMP servers with the same version of Apache, both running Wordpress. SSL is working on both servers (although the test server uses a cert for a different domain).
On both I have the following .htaccess file (/var/www/html/.htaccess):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The test server redirects to HTTPS correctly, but the production server does not attempt to redirect at all. I can manually browse the production site via HTTPS.
The permissions on the .htaccess file is 755 and owned by apache:apache on both server.
In order to make sure that the redirect on the test site was because of the .htaccess file, I changed it by removing the following:
RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
The redirect on on the test site stopped until I added it back.
Is there something that may have been done on the test site that needs to be done on production?
I found the issue so I guess I jumped the gun on posting this question, but I'll leave it here - maybe it will save somebody some time.
In the
/etc/httpd/conf/httpd.conf
file, I hadAllowOverride
set toNone
still on the production site for the document root directory.Here is what it looks like now (with the redirect working):