<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Design Shack &#187; 404</title>
	<atom:link href="http://designshack.net/tag/404/feed" rel="self" type="application/rss+xml" />
	<link>http://designshack.net</link>
	<description>Inspiration, CSS Gallery &#38; Community News</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>An Informative 404 Page</title>
		<link>http://designshack.net/articles/an-informative-404-page/</link>
		<comments>http://designshack.net/articles/an-informative-404-page/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 11:40:14 +0000</pubDate>
		<dc:creator>David Appleyard</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[reporting]]></category>

		<guid isPermaLink="false">http://localhost:8888/?p=171</guid>
		<description><![CDATA[Classic 404 error pages are prone to being relatively useless. Whilst a well designed page can provide a means to find what they are looking for, wouldn&#8217;t it be great if you could find out more about what went wrong? This tutorial will show you how simple it is to have an explanatory email sent [...]]]></description>
			<content:encoded><![CDATA[<p>Classic 404 error pages are prone to being relatively useless. Whilst a <a href="http://designshack.net/tutorials/custom-404-error-page">well designed page</a> can provide a means to find what they are looking for, wouldn&#8217;t it be great if you could find out more about what went wrong? This tutorial will show you how simple it is to have an explanatory email sent to you whenever a visitor hits a 404 page.</p>
<p><span id="more-171"></span></p>
<h2>Getting Started</h2>
<p>The first thing is to implement a custom 404 error page. We&#8217;ve <a href="http://designshack.net/tutorials/custom-404-error-page">covered this before</a>, but it essentially involves adding the following to your root .htaccess file:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">ErrorDocument <span style="color: #CC0000;">404</span> http<span style="color: #339933;">:</span><span style="color: #006600; font-style: italic;">//www.yoursite.com/404.php</span></pre></td></tr></table></div>

<p>This will instruct all 404 error requests to be sent to the specified page rather than showing a default message.</p>
<h2>The PHP Code</h2>
<p>The following code needs to be customized and placed anywhere in your 404 php page:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> 
<span style="color: #000088;">$myemail</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;insert your email address here&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$SERVER_NAME</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$REQUEST_URI</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;404 Page Error&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;
     404 Page Error Report
     Visitor came from: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;
     Page not found: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$page</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;
&quot;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myemail</span><span style="color: #339933;">,</span><span style="color: #000088;">$subject</span><span style="color: #339933;">,</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;From: 404errorpage&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This will send you an email which will include (if possible) both the page which the user has been referred from, and the page or resource which couldn&#8217;t be found.</p>
<h2>Useful Applications</h2>
<p>Implementing this has a whole host of useful outcomes. However, the first thing to note is that (unless you have previously added these files), a rapid number of emails will arrive in relation to:</p>
<ul>
<li>favicon.ico</li>
<li>robots.txt</li>
</ul>
<p>It may well be worth adding these files in before implementing the page so that you aren&#8217;t inundated with notifications! This technique can be invaluable when designing a new site, to sift out any broken links which may have been overlooked before launch. It is even more useful when modifying an existing site structure, to ensure that current links to your site are not taking new visitors to missing pages. If this is the case, simple redirects can be added using .htaccess:</p>
<p><b>For a file:</b></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">RewriteRule file1.<span style="color: #660066;">php</span>$ file2.<span style="color: #660066;">php</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<p><b>For a directory:</b></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">RewriteRule <span style="color: #339933;">^</span>oldfolder<span style="color: #339933;">/</span>$  newfolder<span style="color: #339933;">/</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<p>After a while, you&#8217;ll find that the odd 404 error is due to someone mistyping a URL, or having linked to a genuinely non-existent page on your site. It wouldn&#8217;t be advisable to keep this code in place permanently, but for a few days or weeks after making significant changes it provides a fantastic fail-safe.</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/an-informative-404-page/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Custom 404 Error Page</title>
		<link>http://designshack.net/articles/custom-404-error-page/</link>
		<comments>http://designshack.net/articles/custom-404-error-page/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 13:12:40 +0000</pubDate>
		<dc:creator>David Appleyard</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[page]]></category>

		<guid isPermaLink="false">http://localhost:8888/?p=441</guid>
		<description><![CDATA[The standard 404 error page can often be really frustrating for readers. Using a simple .htaccess file can allow you to customise your error page, and ensure that users are displayed a useful alternative. How to redirect the user You need to create a .htaccess file, using any standard text editor. Copy and paste the [...]]]></description>
			<content:encoded><![CDATA[<p>The standard 404 error page can often be really frustrating for readers. Using a simple .htaccess file can allow you to customise your error page, and ensure that users are displayed a useful alternative.</p>
<p><span id="more-441"></span></p>
<h2>How to redirect the user</h2>
<p>You need to create a <code>.htaccess</code> file, using any standard text editor. Copy and paste the following code &#8211; substituting the path for your local 404 html page:</p>
<pre>
ErrorDocument 404 http://www.yoursite.com/404page.html
</pre>
<p>Once you&#8217;ve done that, you are ready to go. Here are a few ideas of things to include in your 404 page:</p>
<ul>
<li>A search box</li>
<li>A link back to the homepage</li>
<li>The same CSS and graphics as the rest of the website</li>
<li>A website index or map</li>
</ul>
<p>Get creative, make the user feel that they have an alternative route to find what they are looking for, and you&#8217;ll vastly improve their experience on your website!</p>
<h2>Imaginative 404 Pages</h2>
<p>To get inspiration, take a look at some other 404 pages. You&#8217;ll be surprised what you&#8217;ll find!</p>
<p><a href="http://wufoo.com/404/"><img src="http://www.designshack.net/postimages/404page1.jpg" alt="Custom 404 Error Pages" /></a></p>
<p><a href="http://www.last.fm/404"><img src="http://www.designshack.net/postimages/404page2.jpg" alt="Custom 404 Error Pages" /></a></p>
<p><a href="http://technorati.com/404"><img src="http://www.designshack.net/postimages/404page3.jpg" alt="Custom 404 Error Pages" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/custom-404-error-page/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Object Caching 262/289 objects using disk: basic

Served from: designshack.net @ 2012-02-09 13:54:52 -->
