Custom 404 Tips
Custom 404 Tips

There are some cases that visitors or even you misspelled URLs from your site when they try to visit a specific page on your website. Sometimes they use from other site that point to non-existing page or posts from your blogs or website. This happens when you delete a page or rename the permalink or URL of a page. This usually results to a 404 error response from your server or a “Error Not Found” page which is a blank page with a large text: “Error 404 – Not Found.” It will be like a dead end for your readers.

Now, for better user experience, you could customize the 404 page that will be involved for responding to this kind of situation. If you are using WordPress as your CMS for your site, the 404 page is usually part of the theme of the site which you can easily customize by editing it on the theme editor found on the dashboard. The filename is usually 404.php or 404.html for non-Wordpress sites.

You can use the following Javascript from Google to the page to provide a search functionality and page suggestions plus URL fixer for the 404 page: (don’t forget to replace the GOOG_FIXURL_SITE value with the URL of your own site).

<script type="text/javascript">
 var GOOG_FIXURL_LANG = 'en';
 var GOOG_FIXURL_SITE = 'http://www.bleuken/'
</script>
<script type="text/javascript"
 src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js">
</script>

Aside from this Javascript code, you can also list all the posts on your WordPress blog using the following code:

<ul><?php get_archives('postbypost', 1000); ?></ul>

The code will list the 1000 posts of your site and if in case you have more than 1k, just replace it with your desired number.

Don’t be satisfied with a plain 404 page and leave your visitors with nothing for a not found URL. Provide them with something through this suggested tweak or improvement on your “Error – not found” page.

Leave a Reply

Your email address will not be published. Required fields are marked *