I edited my htaccess file to rewrite mysite.com/page
to mysite.com/page.php
and to show 404 error page if a user requested mysite.com/page.php
instead of mysite.com/page
I also added my own custom 404 error page
But when I requested mysite.com/page.php
, the error page shown was Apache default 404 error page (instead of my custom error page), with additional error info:
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
My error log:
Request exceeded the limit of 10 internal redirects due to probable configuration error.
Here is my htaccess file:
RewriteEngine On
RewriteBase /
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
ErrorDocument 404 /error/404
I have tried changing 404 at the last line above to 404.php but the custom error page still not showing up..
However, the custom error page did show up when I requested mysite.com/page/
(notice the slash).