what i learnt today - Tag - mediawikiRandom crap that I learn. No particular topic. Anything I feel I want to post and have the motivation to post, will be posted.2015-08-15T10:48:18+10:00fukawi2urn:md5:a865e0fca55289dd0bb01a2a26e97267DotclearMediaWiki 404 Errorsurn:md5:f54a35bd1bf7587b9d5a7df7667ec5b02010-04-06T10:16:00+10:002015-08-15T21:32:56+10:00PhilComputing404apacheerrorshowtolinuxmediawikiservertechnology<p>Whenever a wiki page that doesn't exist is accessed in MediaWiki, it logs a 404 error in the Apache logs. This quickly adds up to a lot of false-positives on 404 reports for something that is normal operation for MediaWiki.</p>
<p>MediaWiki is doing the correct thing here -- if the page doesn't exist, then 404 should be the HTTP status code. But at the same time, as a system admin, I don't care about these particular 404 errors, so I don't want to be bothered by them in my logs.</p> <p>Solution: Using mod_rewrite and mod_setenvif we can create rules to avoid logging these errors:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/index\.php/(.+)
RewriteCond %{REQUEST_URI} -U
RewriteRule ^(.*)$ - [env=dontlog:true]
CustomLog "/var/log/httpd/wiki-access_log" combined env=!dontlog
This assumes your wiki is in the top-level of... <a href="http://www.wandin.net/dotclear/index.php?post/2010/04/06/MediaWiki-404-Errors"><em>Read</em> MediaWiki 404 Errors</a></p>