当前位置: 首页 > 网络学院 > 设计教程 > 设计理念 > 方便、快捷地制作404页面

设计理念
做好网站的定律
创建好网站的20点建议
如何吸引别人阅读你的网页
网站内容管理系统(CMS)
网站的有效性验证
小型网站设计中容易出现的10点错误
企业标志设计
网站设计价格和成本
成功设计电子商务网站的方法
网站的设计如何能让搜索引擎优化——三种利用css的方式
构建个人网站的6个步骤
如何构建一个相对简单的微型网站
网站设计的5个简单步骤
网站设计中应该避免的问题
全球化的发展需要高质量的网络设计
提高网站下载速度的简单方法
吸引用户回访的最好方法
网站设计应该避免的25种常见错误
改善网站导航系统的几个要点
网站设计的十大错误

设计理念 中的 方便、快捷地制作404页面


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1732 ::
收藏到网摘: n/a

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服务器,你可以很快完成。

Quick_And_Easy_Custom_404_Pages

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或者其它要求,确保网页可以发挥作用。

评论 (0) All

登陆 | 还没注册?