I had a custom 404 error redirect page working just fine through htaccess. However, after adding new code to htaccess, it stopped working. What's causing the conflict and how can I fix it?
EDIT: I've tried putting the ErrorDocument line at the top of the page and it still doesn't work.
htaccess code:
RewriteEngine On
#Removes www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule . http://%1%{REQUEST_URI} [R=301,L]
#Redirects to extensionless php urls
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^&\ ]+).php
RewriteRule .* /%1? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ $1.php [L]
#Redirect nonexistent files to a 404 page (not working)
ErrorDocument 404 /404.html