Search code examples
php.htaccesshttp-status-code-404

.htaccess not redirecting to 404.php instead shows page name


Am trying to make a custom 404 page for my website and am having .htaccess file in the root directory where am using this rule

ErrorDocument 404 404.php //I want to redirect to 404

So when I change a valid file name like home.php to home1.php it doesn't redirect me instead it echo's 404.php on that page

Side Note: 404.php is in the root directory only


Solution

  • This should do it

    RewriteEngine on
    ErrorDocument 404 http://www.yoursite.com/404.php