网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   代码交流 (https://www.0058.net/forumdisplay.php?f=16)
-   -   How do I make custom 404 error documents? (https://www.0058.net/showthread.php?t=1597)

topvip 2006-10-18 12:35 AM

How do I make custom 404 error documents?
 
How do I make custom 404 error documents? A 404 error page is a page that shows up if someone tries to access a page that doesn't exist on your domain. This is very easy to do, however, you do have to have your own domain to do this in most cases. Upload a text file with FTP to your main directory with the following line:

ErrorDocument 404 http://www.yourdomain.com/error.html

Change the information in bold text to your own information (your domain and the url to your error page). After you've done that, save the file as .htaccess Make sure to include the dot in front. Next you need to make your error page. This is a regular HTML document that lets people know they've reached that page in error.

Upload the error page, and now when you type in an incorrect url to your domain, your custom error page will appear. You can add whatever you want to your error page, a redirect to your main site is always a good thing to include.

An .htaccess file is a plain text file that contains server directives. You add these directives line by line, one on each line. They can be added in a main directory or a subdirectory, but if you add it into the subdirectory it will cancel out any .htaccess file you have in the main directory. Some things you can do with .htaccess are error documents, password protection, and image protection.


All times are GMT +8. The time now is 10:43 AM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.