0

We are running a WordPress site on a AWS EC2 Linux instance and have created custom 403 and 404 error files (both html files). The files are located in the root of the website.

The root .htaccess file has been amended to include the following section:

# Custom Documents

ErrorDocument 403 /403.html

ErrorDocument 404 /404.html

The site uses a theme and within this there is a 404.php file. The problem is that any 404 requests are being routed to this file instead of the 404.html file.

The httpd.conf file has all access set for the root folder var/www/html so there’s nothing in it that I can see that would be blocking the .htaccess file. As a double check I added some 301 redirects into the .htaccess file just to check if they were getting hit and they were working.

Also checked if there were any other .htaccess files which might be overriding the one in , there were some in a plugin but from what I can see they shouldn’t have any impact.

Is there anything else which could be overriding the .htaccess file?

  • I think you should include the absolute path to the error status pages. – Itai Ganot Jan 24 at 9:49
  • Thanks @ItaiGanot - Already tried that - just forgot to add in above! – Paul Jan 24 at 10:08
  • Which PHP SAPI are you using? – Michael Hampton Jan 24 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.