偶尔,用户可能会做出一些让Drupal头疼的事情,比如说键入了一个错误页面或者试图访问他们无权访问的内容.这些将分别生成404 和403错误.
在最近的一篇SEO文章中提到,让Drupal处理这些错误的好处:
你的404错误页面应该和你站点的其它页面一样.它应该包括站点的页首,页脚和导航条,这样用户可以方便的点击你站点的其它区域.这个404错误页面的内容应该包括解释信息,向用户解释所访问的页面现在不可用,还有就是联系信息,这样用户可以联系你,发邮件或者给你打电话.
当用户看到一个错误页面时,总会有些沮丧的.而现在,很明显,最好的做法是让用户方便的回到你的站点上去.
对于“拒绝访问”("access denied" (403))错误消息页面,道理也基本上是一样的。让用户知道他们不能这样做,并给他们解释为什么这样。
导航到"Create content",选择"Page."。我使用的标题为"Access Denied" 和"Page Not Found",你可根据你的实际情况采用自己的标题。当你提交以后,记住节点的id。接着,导航到Administer >> Site Configuration >> Error,在相应的字段中输入"node/nnn"。
Page Not Found(未找到相应页面)
下面是我的404页面的HTML:
<p>Sorry! The page you were looking for no longer exists. We redesigned our site and many of the pages have changed.</p>
<p> </p>
<p>If you are unable to find something on our new site or have a question about our site or services feel free to <a href="/contact">contact us</a>.</p>
<p> </p>
<p>--Webmistress</p>
Access Denied(拒绝访问)
下面是我的403页面的HTML:
<p>We're sorry, but you must have permission to view the page you requested.</p>
<p> </p>
<p>If you are already a registered member of this site, please try <a href="user">logging in</a>.</p>
<p> </p>
<p>If you are not a member, you need to <a href="/join_us">join us</a>.</p>
<p> </p>
<p>If you have any questions about our site or group, please feel free to <a href="/contact">contact us</a>.</p>
<p> </p>
<p>--Webmistress</p>
不要担心,你尚未创建"join_us"页面。这就是启用URL别名(Path module 路径模块)的好处。将创建该页面放在你的待做任务列表中,在本书后面的章节中将会讲到相关的内容。
相关联接:http://drupal.org/node/120646
Think in Drupal(转载时请勿删)