Well I though I must share this with you because it is such a simple thing to know but still lot of us don’t know which config property we work with to achieve 404 redirects.
This should be a habit of yours when working as a Web developer that no links are broken what if one or two of them are and user see weird apache errors. Better thing will be to redirect to say a sitemap of your website or any other informative page rather than displaying “404 not found”.
If annoying for your website visitors as well when they see this.
Alright now let me talk about prerequisites to configure this properly.
- Your hosting company should support .htaccess file
- AND you are able to change .htaccess file
Now that the boring part is gone, let me give you an example
Copy this link below and paste it in your browser and then see what happens
http://jaspreetchahal.org/isstupid.html
It should display a lot of info and should tell you that URL is not found and you can browse to other interesting places on my website.
Now the setting
Open up your favourite text editor and then open .htaccess file that lives in root folder of your website (if it does not exist then create one) and add this line to that file
ErrorDocument 404 /filenotfound.html
Now create a file named filenotfound.html in your root folder of you website and add whatever information you would like to add-in and then try to goto a URL that does not exist in your website.
That’s it. You’ve just configure your permanent 404 error document for your website.
Please let me know if you have questions
Cheers
Search Terms:
- apache 404
- apache email adres 404
- apache error document media
- apache htaccess errordocument
- cannot open html file 404
- configure apache htaccess error documents
- configure htaccess redirect all error document








Recent Comments