Skip to content
Advertisement

How to redirect 404 error to 404.php page?

I need help in php. I am making one portal website in Core Php. I had created 404 page and .htaccess file.

404.php:

JavaScript

.htaccess:

JavaScript

But this is not working. If I use this code:

JavaScript

It shows internal server error.

Here is my website: http://jobguide.australianenglishcenter.com/

Advertisement

Answer

Try this in your .htaccess:

JavaScript

Here,The ErrorDocument redirects all 404s to a specific URL

The Rewrite rules map that URL to your actual 404.php script. The RewriteCond regular expressions can be made more generic if you want, but I think you have to explicitly define all ErrorDocument codes you want to override.

NOTE: Replace

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement