Log of Apache rewrites

╄→гoц情女王★ 提交于 2020-01-04 05:26:53

问题


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?


回答1:


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




回答2:


See RewriteLog and RewriteLogLevel directives.




回答3:


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:'



来源:https://stackoverflow.com/questions/7746769/log-of-apache-rewrites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!