views:

91

answers:

3

Hi,

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) to my custom page?

Thanks

A: 

This should redirect all nonexistent files in the same directory as that .htaccess file. What happens in case a nonexistent PHP file is requested?

Thomas
actually depends on browser, in firefow i get "no input file specified." in chrome just "HTTP 404 - File not found"
Ahmet vardar
A: 

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.

Thomas
A: 

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]

Magda