Apache ModRewrite is not logging data

Discussion in 'General' started by kyferez, Apr 11, 2019.

  1. kyferez

    kyferez Member

    I am using a couple rewrite rules configured in .htaccess files. I am having some trouble with rewrites and getting 404 errors so trying to debug them by enabling rewrite logging. I have Apache 2.4, and per the Apache docs, I should use this in a Vhost file to enable logging, so I added it to the site's Apache Directives exactly as shown below:
    RewriteEngine On
    LogLevel core:info rewrite:trace8 alias:debug​

    This is one of the .htaccess Rewrite rules:
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]
    </IfModule>​

    However I am not getting any Rewrite logging at all in /var/log/httpd/*, or /var/www/site1/log/* though I do see the 404 errors (which I didn't see before adding core:info to the LogLevel setting).

    EDIT: At this point, I think the URL isn't getting rewritten, does the lack of logging mean I am not hitting the rewrite??? Example URL that is returning 404 (internal only web server and URL):
    http://site.tg.local/css/bootstrap.min.css
    Should be rewritten to:
    http://site.tg.local/app/webroot/css/bootstrap.min.css

    According to this site it should match, but either it's not getting rewritten or it's incorrect somehow: https://htaccess.madewithlove.be/

    Any ideas? Perfect server guide followed for CentOS 7.4 and everything is working perfectly, except this rewrite and/or rewrite logging of course.

    Thank you!
     
    Last edited: Apr 11, 2019
  2. kyferez

    kyferez Member

    I have fixed part of the site, and have confirmation the Rewrites ARE working and Logging IS working - it is putting them in /var/www/clients/client1/web1/log/error.log.
     

Share This Page