I am trying to set the redirect for a 404 inside my .htaccess file but it doesn’t seem to be working. If I try a relative URL starting with a / that isn’t found. If I try a full URL from https:… that doesn’t work either.
Currently the first line of the htaccess file is
ErrorDocument 404 "test to see"
This also isn’t working.
I know the htaccess file is working as it is used for other things.
Any ideas on what the problem might be and how to solve it please?
ErrorDocument 404 "test to see"
RewriteEngine On
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
AddHandler application/x-httpd-php72 .php
2
Answers
Found the issue.. had a duplicate htaccess file in another subdirectory, causing a conflict. Sorry for the inconvenience of those trying to help but posting this so hopefully someone sees this to help them..
You should check in apache configuration files if ErrorDocument is allowed in .htaccess.
Use
AllowOverride FileInfo
to allow ErrorDocument.