Jump to content

Rewrite for a certain directory to a new file?


TomasDR

Recommended Posts

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,

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.