TomasDR Posted December 20, 2007 Share Posted December 20, 2007 I am looking to accomplish something, if I can just eliminate it from the error logs I would be just as happy. I have a forum where users can upload files, they all upload into a single directory. Then the users imbed those images into threads. Well sometimes users delete images with of course results in an error_log entry. File does not exist: /var/www/xxx/forum/imagehosting/656846679f2c4ec2d.jpg, referer: Is it possible to either eliminate the "File does not exist" errors from just that directory. OR Can I use the mod_rewrite to load a generic jpg? Thanks in advance, Quote Link to comment Share on other sites More sharing options...
tibberous Posted December 30, 2007 Share Posted December 30, 2007 Yes, you can. Should be, RewriteEngine On RewriteRule ^forum/imagehosting/(A-Za-z0-9)+\.jpg$ notfound.jpg Something like that anyway Quote Link to comment Share on other sites More sharing options...
madmax Posted January 8, 2008 Share Posted January 8, 2008 Use SetEnvIf rather than mod_rewrite - it's much easier. You can use any variation or number of statements to set an environment variable called "dontlog" then use this as a flag to control logging with CustomLog. Don't forget the required LoadModule statements to ensure the required modules are loaded. You may also want to make full use of the CustomLog module to customise your logs in other ways. Bear in mind also that you can set other ENV flags and then use those indirectly to set "dontlog" (e.g. local IP addresses or other unwanted files). LoadModule setenvif_module modules/mod_setenvif.so LoadModule log_config_module modules/mod_log_config.so SetEnvIf Request_URI "/folder/subfolder/filename\.typ" dontlog CustomLog logs/access.log combined env=!dontlog Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.