In my post yesterday I wrote about taking 404 errors and using them to your advantage, in this post I want to build on that and talk about tracking down 404 problems and fixing them.
What is A 404 and Why Fix It?
404 is the error returned by web servers to browsers if a file cannot be found. This is a standard error and is usually a dead-end on a website.
We need to fix certain 404 errors because people are coming to your site expecting to find content but are getting errors instead, this does not look good to fickle blog readers, the slightest thing can make people unsubscribe or not come back to your site.
Finding 404 Errors
How do you find what URLS are causing 404 errors on your site? You look in your logs. You should have a log file of all the accesses of your site, these will show what page, the referer, what user agent (browser) and many more things. The thing we are interested in is the http return code, searching for 404 will show your problem URLS.
Each hosting provider will have a different config for their logs, please refer to their documentation on how to review your access logs.
Here is a sample from my log file, I have highlighted the 404 error message and the page/post name.
“150.70.xxx.xxx – – [19/Nov/2009:10:28:25 -0700] “GET /hire-me HTTP/1.0″ 404 17600 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)”
Here I can see that there was a file not found error trying to retrieve the page hire-me. This is not good, a potential client is getting a 404 because I have renamed that particular page.
Fixing That Problem
Once I find a 404 error I want to fix it by redirecting to a live page. I know what you are thinking, he is about to tell us about a plugin after he had us ferreting about in our log files, you are quite correct, and it’s only because I care and want to give you a holistic view of your 404 problems that I asked you to look in your logs 🙂
I use a plugin called redirection which (as the name suggests) redirects URLs to other URLS. Check it out at http://urbangiraffe.com/plugins/redirection/
The beauty of this plugin is that it has a 404 detection function. Using that I can very quickly find out which URLs are causing me problems and then fix them. Below is a screenshot of my 404 for today.
Both of these URLs are ones I have renamed, I want to fix the 404 errors by redirecting them to the new page.
Using the redirection plugin I can set up a URL interceptor which will capture all visits to the 404 URL and do a 301 redirect to a new page or post. 301 redirects are cool if the visitor came from a search engine, because next time you site is indexed, the incorrect URL will be updated to the new one.
See It In Action
I have setup a redirection for /hire-me, see what happens if you click on
http://neilm.wpengine.com//hire-me (hint check the browsser bar for the new URL)
Don’t Fix Them All
If people are getting 404s because of typos or things like that I do not recommend creating redirects, only redirect things which are real issues like renamed pages
Get your 404 errors fixed, it makes you look more click and professional with an increased chance of subscription or other action.