user943301
user943301

Reputation:

Log of Apache rewrites

I'm getting a "webpage has a redirect loop" error. Most likely this is due to my Apache rewrite configuration. I've had these issues before, and find them hard to debug. Is there some sort of log that allows me to see what the request is being redirected to?

If not, how do you debug Apache rewrites in an efficient way?

Upvotes: 4

Views: 4472

Answers (3)

scruffy
scruffy

Reputation: 351

If you are using newer Apache version (I'm testing it with 2.4), the RewriteLog directive has been replaced by the new per-module logging configuration (see apache doc).

Now you want to put the following line in your configuration:

LogLevel alert rewrite:trace3

and check your error log for the rewrite module messages.

tail -f error_log|fgrep '[rewrite:'

Upvotes: 1

Alex Howansky
Alex Howansky

Reputation: 53646

See RewriteLog and RewriteLogLevel directives.

Upvotes: 0

Will Chesterfield
Will Chesterfield

Reputation: 1780

You can configure mod_rewrite's log file via the "RewriteLog" directive.

For example:

RewriteLog "/usr/local/var/apache/logs/rewrite.log" 

For more information, see: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog

One other link I find myself going back to is "crazy advanced mod_rewrite" -- lots of info there which you may want to stash away for future reference. It's at: http://www.askapache.com/htaccess/crazy-advanced-mod_rewrite-tutorial.html

Upvotes: 0

Related Questions