mod_rewrite and httpd24-httpd

Latest response

I am trying to configure mod_rewrite with httpd24-httpd service and it does not seem to be working. My old site.conf file is

RewriteCond %{HTTP_HOST} ^site.example.com$ [NC]
RewriteRule ^/$ http://site.example.com/site/ [L,R]
RewriteCond %{HTTP_HOST} ^alt-name.example.com$ [NC]
RewriteRule ^/$ http://alt-name.example.com/site/ [L,R]
alias /site "/www/site"

Require all granted
RewriteEngine on
RewriteBase /site
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.)$ index.php?q=$1 [L,QSA]
RewriteCond %{HTTPS} off
RewriteRule (.
) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST} !alt-name.example.com
RewriteRule ^.*$ https://alt-name.example.com%{REQUEST_URI} [R]

Under the prior base installation version of apache, the mod_rewrite works perfectly. Anyone going to site.example.com gets redirected to site.example.com/site/, then redirected to https://alt-name.example.com/site/

Similarly if they visit alt-name.example.com, they get redirected to alt-name.example.com/site/, then https://alt-name.example.com/site/

When I use this exact combo in the scl version, nothing seems to happen. I have the file paths in /opt/rh/httpd24/root/etc/httpd/conf.modules.d/00-base.conf pointing to /opt/rh/httpd24/root/usr/lib64/httpd/modules/mod_[file].so so that the httpd24-httpd daemon pulls the correct version of the module from scl instead of the base install.

But still, the rewrite never happens. When I visit site.example.com, I get our base index.html page at (local filesystem) /www/html instead of the correct page at /www/site as shown in the Directory stanza. Why does this not work correctly? Or is there some config I missed when I was setting this up? I've tried loading mod_rewrite from the scl path directly, and I get the message that mod_rewrite has already been loaded. So I do not understand how the module can be loaded and still not work properly.

Responses