Forums

IGNORABLE_404_URLS does not work

I have set my settings.py in order to avoid sending 404 error pages taht are due to crawlers. I did as described in the django documentation, especially for these two variables

IGNORABLE_404_URLS = [ re.compile(r'.(php|cgi)$'), re.compile(r'^/phpmyadmin/'), re.compile(r'^/apple-touch-icon.*.png$'), re.compile(r'^/robots.txt$'), re.compile(r'^/roots.php$'), ]

MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.common.BrokenLinkEmailsMiddleware', ]

=====> This should avoid sending any 404 error emails for links like

mydomain/robots.txt

But actually it is not working and I am receiving a lot of 404 error emails

I have the same problems with .php urls, for example

mydomain//include-sql.php

This should be ignored regarding my settings but it is not working.

Thank you for your help Ayoub

I'm not sure why that wouldn't work. Perhaps you can experiment with the regexes you're using and the urls that you're getting emails for to see whether they do actually match.