簡單快速地制作404頁面_網頁設計教程
推薦:網站中應避免出現彈出窗口Nottoolongago,seeingapop-upadappearmeantthatyouwereeitheronapagethatdistributedillegalsoftwareorlookingatsomethingthatisn't
By design, the server that hosts your web site delivers a 404 Error / Page Not Found when a surfer clicks on a link that the server cannot find or something else unexpected happens. The most common error page is the HTTP 404 "Not found: The requested URL/whatever.html was not found on this server."
當訪問者鏈接服務器不能提供的頁面,或者網絡出現問題時,服務器會提供404錯誤頁面。當輸入的URL或者網址未被找到時,經常出現的錯誤頁面是HTTP404“未找到”頁面。
This generally happens when a person clicks on a link for page that has been removed, renamed or otherwise changed.
假如點擊已移除、重命名或者已修改的網站鏈接,就會出現404頁面。
What happens to your web visitor who got that error message? Generally speaking they're off faster than a "speeding bullet" looking for the information they were seeking - probably to a different website. That's something you really don't want to have happen and it can be prevented with a custom 404 error page that gives them options on the error page that will tell them how to find what they were looking for.
得到出錯信息之后,網站訪問者應該如何做呢?一般來說,他們會迅速離開網站,轉而登錄其它網站尋找所需信息。我想你肯定不希望發生這種事情,那么你可以創建404頁面,引導用戶找到所需的內容。
So the answer is? Create your own custom 404 Error page that suggests other resources on your site and then helps redirects that person to them.
如何解決呢?創建404頁面,引導用戶找到所需信息。
In essence you're capturing traffic that you had, but lost and didn't know it, and keeping that visitor by helping them find what they need and possible turn them into a buyer for your product or service later on.
其實,網站正在盡力挽留流失的訪問者,幫助他們找到所需信息,并且盡可能把他們轉化成網站產品或服務的購買者。
But "I don't have the time or know how to make a custom 404 page", you say.
但是,你可能會說,我沒有時間,也不知道如何制作404頁面。
Well good news - it's not as hard as you think. If you have about 30 minutes and your server is a Unix web server then it's virtually a snap to do.
事實并沒有你想得那么復雜。你只要利用30分鐘的時間,利用Unix服務器,你可以很快完成。
Your Custom 404 Page Design
404頁面的設計方法
In my opinion your custom 404 error page should provide at least these four components:
我認為,404錯誤頁面至少應該包含以下四項內容:
A statement that the requested page was not found.
陳述頁面未找到。
Description of why the page may be missing.
介紹沒找到頁面的原因。
A site search box for the surfer to look for other pages on your site.
提供搜索框,確保訪問者登錄網站其它頁面。
A "plug" for one of your Free products or services.
指引用戶登錄免費產品或者免費服務網頁。
You can of course add other components like simple java script code for date & time and IP address display, etc. if you really want to impress someone with your technical wizardry.
當然,你可以添加其它內容,比如說簡單的java script編碼以及IP地址等等,這樣可以讓用戶對網站技術留下深刻的印象。
Your page also should carry the look and feel of your web site, so you should include your header or footer or both so it is clearly branded as yours. You may wish to include some other links for your site that lead visitors to other pages you may want them to visit.
404網頁應該與網站外觀、風格一致,所以應該包括頁眉、頁腳或者兩者兼有,這樣才能保持網站特征。或許你希望網頁設置其它鏈接,引導訪問者進入你希望他們進入的頁面。
Here are the basic steps:
基本步驟
The simplest method is to create your new custom page, then upload it to your site in the same folder where your home page is located. Servers vary in their requirements. For mine the page must have a specific name for it to function properly as my custom 404 error page.
最簡單的方法就是頁面創建完畢后,上傳到包含主頁的文件夾中。服務器會根據需求不斷變化,我認為404頁面必須有非凡名稱,可以正確發揮作用。
If you don't have an .htaccess file you need to create one in the same folder where your home page is stored, (in some cases, the file may already exist; on servers with FrontPage extensions this file is automatically created). You'll need to do a simple edit in this file. Use your text editor or server editito to add the following command:
假如沒有.htaccess文件,你需要在包含主頁的文件夾中創建一個(通常這個文件已存在,擁有FrontPage的服務器會自動創建這種文件)。當然,你需要對文件稍做改動,利用文本編輯器或者服務器編輯工具,增加以下命令:
ErrorDocument 404 /filename.html
(where "filename.html" is replaced by the name of the actual file you want to appear as your Custom 404 Error page.)
(這里"filename.html"被404錯誤頁面的實際名稱所取代。)
You could, if you prefer, to insert your home page when a 404 error occurs. In that case, the correct command to add to your .htaccess would be:
404頁面出現時,可以插入主頁。假如這樣,添加到.htaccess文件的正確命令就是:
ErrorDocument 404 /index.html
The above example assumes your home page is named index.html. If not, replace it with whatever name you are using for your home page instead.
上述例子中,我們假設主頁被命名為index.html;假如不是,運用主頁的其它名稱把其代替。
If you use Microsoft Internet Explorer and the option to Show friendly HTTP error messages is enabled, the file size of your custom error page must be no less than 512 bytes to function properly. Otherwise, the program will show a generic message.
假如使用Microsoft Internet Explorer,你可以正確顯示HTTP錯誤頁面,但錯誤文本的頁面應該小于512bytes,否則程序會呈現一些普通信息。
There you have it. Design your page, follow the two simple steps above and you'll soon have your own custom 404 error page that will capture lost visitors and keep them on your site.
現在,你可以根據以上兩個簡單步驟,創建可以挽回網站訪問者的404頁面。
One final note - before you start on setting up your own custom error page check the FAQ or knowledgebase for your website's server for the specific requirements for making sure your new page works.
最后需要介紹一點,在創建404錯誤頁面之前,閱讀網站服務器的FAQ或者其它要求,確保網頁可以發揮作用。
分享:網站設計中常犯的錯誤Themostcommonwebdesignmistakeistodesignfortheexception,andtoignoretheobvious.That'sbecausedesigningfortheobviousisboring,whi
- 相關鏈接:
- 教程說明:
網頁設計教程-簡單快速地制作404頁面
。
