Redirecting to php / html file on 404 error with .htaccess

I want to redirect all 404 errors to "404.php", for example.

I tried using it ErrorDocument 404 /404.phpin .htaccess, but without luck, maybe my other rules do not allow it in some way, I'm not sure, because I could not find this information on www.

If anyone has an idea how to solve this, please shout: P

My current .htaccess

#### pie thingy ####
AddType text/x-component .htc

#### Rule for Error Page - 404 ####
ErrorDocument 404 /404.html

#### url rewriting ####
Options +FollowSymlinks
RewriteEngine on

#### REDIRECT IF NO SUB-DOMAIN ####
RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)$ [NC]
RewriteRule ^(.*)$ http://www.%1.%2/$1 [R=301,L]

#### Remove "www." from any subdomain requests ####
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.precisehire\.com [NC]
RewriteRule (.*) http://%1.precisehire.com/$1 [R=301,L]

#### Rules for rewriting from PHP to HTML with fallback ####
RewriteCond %{REQUEST_URI} ^/(.*)\.html$
RewriteCond %{DOCUMENT_ROOT}/%1.php -f
RewriteRule ^(.*)\.html$ $1.php [nc]
+5
source share
1 answer

Solved by posting the full URL for the error document.

Example:

#### Rule for Error Page - 404 ####
ErrorDocument 404 http://www.domain.com/404.html
+12
source

All Articles