The .htaccess file is what Apache web servers use to allow you to fine-tune your web server configurations at a directory level. Other types of web servers may handle the customization of 404 error pages differently.
The first thing you need to do is to add the following line to a file named ".htaccess" (note the preceding period). In most instances, no such file will exist, and you can simply create one with a text editor.
You will need to put a "errorpage.html" file in the main web directory for the above directive to work.
The "ErrorDocument 404" directive essentially tells the Apache web server that whenever it cannot find the file it needs in that directory and its subdirectories, it is to use the document specified in the URL that follows if you want a certain subdirectory to show a different 404 Error message, you can always put a different ".htaccess" file into that directory. This will override any ".htaccess" files you have in the parent directories..
The first thing you need to do is to add the following line to a file named ".htaccess" (note the preceding period). In most instances, no such file will exist, and you can simply create one with a text editor.
ErrorDocument 404 /errorpage.html
You will need to put a "errorpage.html" file in the main web directory for the above directive to work.
The "ErrorDocument 404" directive essentially tells the Apache web server that whenever it cannot find the file it needs in that directory and its subdirectories, it is to use the document specified in the URL that follows if you want a certain subdirectory to show a different 404 Error message, you can always put a different ".htaccess" file into that directory. This will override any ".htaccess" files you have in the parent directories..
No comments:
Post a Comment