custom 404 page for nonexistent php files
I just tried to redirect nonexistent files on the server to my custom 404 page but it only redirects .html files.
I used that in my .htaccess file:
ErrorDocument 404 /404/404.html
How can I redirect all nonexistent files (including .php开发者_C百科) to my custom page?
Thanks
This should redirect all nonexistent files in the same directory as that .htaccess
file. What happens in case a nonexistent PHP file is requested?
It could be that some other rule or directive (for example, a redirect) processes the PHP files before it gets to your ErrorDocument
directive. Without more information, this is impossible to tell.
Try that:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteuRule .* home.html [L]
If you wants 404 redirection RewriteuRule .* home.html [R=404,L]
精彩评论