Error document configured in .htaccess file not work properly

Viewed 227

On my cPanel account I have a htaccess file which looks like this:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^(.*)\.html$ $1.php [nc]   //for rewrite all .php file with .html extension

RewriteRule ^$ /index.html [R=301,L]   //for rewrite home page to url with index.html
RewriteRule ^/$ /index.html [R=301,L]  //for rewrite home page to url with index.html

ErrorDocument 404 /404.html

Problem is: when i open link like: https://www.domainname.tld/test ---> i have correct 404 error (page not exist) https://www.domainname.tld/test.php or test.html ---> i have default 404 error of Apache

This is very strange...

I contact cPanel support and they say me that not is a cPanel error Can you help me?

1 Answers
Related