mod_rewrite, RewriteLog is empty

I am working on a project where RedHat is being used in the production environment. I wanted to duplicate the production environment as closely as possible so I set up Fedora 14 on my local machine (Apache 2.217 and PHP 5.3).

I copied the httpd.conf file from our production server onto my local and only changed the <directory> location.

mod_write is installed (verified via phpinfo()), but it is not working. I am able to access the home page of the site, but I get 404 errors when I try to access any other page on the site.

For instance, I receive an error on:

localhost/about/

but I can view the page, when I enter:

localhost/index.php?/about/

I added the RewriteLog directive in httpd.conf (I’m not using vitrual hosts because I want to duplicate the production environment as much as possible):

RewriteLog “/etc/httpd/logs/rewrite_log.log”
RewriteLogLevel 9

Nothing is being written to the file. I verified that the file is owned by root and is writeable:

ll /etc/httpd/logs/rewrite_log.log

-rw-r–r–. 1 root root 0 Apr 20 12:52 /etc/httpd/logs/rewrite_log.log

Although I don’t understand why mod_rewrite is not working, I guess my primary question for now is, why is the rewrite log file blank? The apache error log shows ‘file not found’ when I try to access any page except the home page.

Partial httpd.conf

RewriteLog "/etc/httpd/logs/rewrite_log.log"
RewriteLogLevel 9

&lt;Directory "/var/html/mrisweb/trunk/www/htdocs"&gt;

Options Indexes FollowSymLinks

AllowOverride None

Order allow,deny
Allow from all

SetEnv APPLICATION_ENV localdev


RewriteEngine On
RewriteBase /

# Rewrite rules for EE index.php
RewriteCond %{REQUEST_URI} !^/_res
RewriteCond %{REQUEST_URI} !^/application
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php/$1 [L]
#
&lt;/Directory&gt;

Again, this is the same httpd.conf file that is used in our production and test environments.

Any help is appreciated.

Thanks,

Les

That is very odd! I assume you’ve restarted Apache after you added the RewriteLog and RewriteLogLevel derictives?

Yes, I rebooted apache after each change.

I just got to thinking that on almost no host Apache runs under the user root. It almost always runs under the user apache or www-data (even if you start it as root).

You can see which user is running Apache by typing ps aux on a command line and see which user is running httpd.

Once you know that change the permissions of the rewritelog file so that that user can write to it and it should work as intended :slight_smile: