Re: RHEL6 software collections mod_rewrite not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's the little things.....

Apparently I was missing "RewriteEngine On" at the top of the file.  Sorry if this wasted anyone's time...

On Thu, May 2, 2019 at 3:34 PM Jim Weill <moondog@xxxxxxxxxxxxxxxxx> wrote:
We are trying to use the software collections version of apache 2.4 (httpd24-httpd package) on RHEL6 and it claims mod_rewrite is being loaded but none of our previously working rewrites seem to be doing what we expect.  We have a site.conf file as follows:

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"
<Directory "/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]
</Directory>

In the base apache 2.2 version, this works perfectly to redirect anyone who enters "site.example.com" or "alt-name.example.com" first, to "http://site.example.com/site/" or "http://alt-name.example.com/site/" respectively, then redirects to "https://alt-name.example.com/site/"

If I run the httpd24-httpd daemon (via /sbin/service/httpd stop; /sbin/service httpd24-httpd start), none of these rewrites work, and instead of a redirect, it loads the html root index.html file, which in this case would be /www/html/index.html as configured in the httpd.conf file.  phpinfo() does show I am running apache 2.4, so I know the daemon is at least reporting the version I expect to see.

I've tried reading through the 2.4 documentation and I don't see how we are doing anything so differently from the 2.2 directives, other than I think the stanza above the alias might need to go inside the <Directory> section since RewriteEngine needs to be called first...?   But even this change does not redirect the way it used to.

I have even surrounded the various sections of the RewriteCond and RewriteRule with double quotes (as in RewriteCond "%{HTTP_HOST}"  "^site.example.com$" [NC]) as shown in the 2.4 config pages, and this does not help one way or the other.  LogLevel is set in the httpd.conf file as "LogLevel trace3 rewrite:trace8" and I do get the following message when I restart the daemon:

Starting httpd: [Thu May 02 15:15:45.565074 2019] [core:trace3] [pid 26668] core.c(3347): Setting LogLevel for all modules to trace3
[Thu May 02 15:15:45.565224 2019] [core:trace3] [pid 26668] core.c(3375): Setting LogLevel for module mod_rewrite.c to trace8
 
But I cannot find where any URL is being written in the logs.  I know the Software Collections is supposed to be run via the scl command, but this particular service is supposedly able to be configured as semi-permanent, but the behavior seems to be very limited compared to the 2.2 base version that comes with RHEL6.  Is there something else I am missing here?  Why do the directives seem to be ignored?

jim


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux