Writings

Take Advantage of Bing to Handle 404 Errors

Last week Cal Evans announced the release of the Bing404 Plugin for WordPress, a plugin that takes advantage of the Bing Search Library for PHP released by the Interoperability @ Microsoft team. Cal did a great job with those articles and I’d recommend checking them out.

When using the Bing404 Plugin instead of users seeing the standard WordPress error when a page is not found, Bing is queried for results within your site and a list of possibly relevant links is shown instead.

Here, I’ll share with you our experience getting started using this Plugin.

How It Works

Usually, users will receive a 404 error and a search box when they request page on your site that doesn’t exist.

image

If you don’t see the WordPress error handling above, but instead see the default IIS 404 error below, don’t worry. We’ll take care of this in Step 4.

image

When you install the Bing 404 Plugin, Bing will be queried for pages within your site when someone gets a Page Not Found error.

image

Give it a try here: http://wordpress.visitmix.com/foo

Installation

Marco Tabini recorded a great screencast on YouTube that goes through the few simple steps to install the Plugin. It should take less than 5 minutes and consists of the following steps:

1. Install the Plugin

2. Get a Bing AppID

3. Configure the Plugin

4. Enable IIS Pass Through Error Handling (not covered by Marco)

5. Test It

1. Install the Plugin

The first thing you need to do is install the Plugin; it’s in the WordPress Plugin Gallery. The easiest way to do this is to go to Add New in the Plugins section of your WordPress admin and Search for Bing404 (all one word).

image

You should get one result, which you just need to Install.

image

Next, select Install Now.

image

This will download the Plugin to your wp-content/plugins folder. Now, just click on Activate Plugin.

image

2. Get a Bing AppID

Start by visiting http://www.bing.com/developers/createapp.aspx, which will prompt you for a LiveID.

image

Provide a few details about the application.

image

This will generate an AppID,which you need to copy for the next steps.

image

3. Configure the Plugin

Once you’ve activated the Plugin,you should have a new option for Bing 404 under the Settings in your WordPress admin.

image

Enter your Bing API Key, Site Specific Search and Number of rows to return and click Save Changes.

image

That’s it!

4. Enable IIS Pass Through Error Handling

This may be the most tricky/confusing issue. Even after you’ve installed and configured the Plugin, you may still see the default IIS 404 error message.

image

This is probably happening because IIS, by default, is configured to not show detailed error messages for security reasons. The best workaround is to enable PassThrough error handling. This will allow your application to handle errors and still hide sensitive configuration details from the end user.

If you aren’t already using a web.config for URL Rewrite, etc. just create a new file named web.config in the root of your site. It should have the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough" />
    </system.webServer>
</configuration>

There’s a high likelihood that you already have a web.config for URL Rewrite.  In this case, you just need to add <httpErrors existingResponse=”PassThrough” /> to the <system.webServer> section of the file.

Checkout this post on iis.net for more details.

5. Test It

Now all you need to do is enter a URL that doesn’t exist on your site. Instead of the traditional WordPress 404 error page, Bing will be queried for results within your site and provide applicable links.

image

If you’re interested in digging deeper, Cal has another article that talks about using the Bing Search Library with some sample code.

Comments 8 Comments - Join the conversation

  1. If you use Windows Vista or Windows Server 2008 and install WordPress by using Web Platform Installer then there is no need to enable IIS pass through error handling as described in step #4. This is because Web Platform installer automatically installs the FastCGI update that fixes the error handling behavior in IIS FastCGI. If you do not already have this update then it is highly recommended to install it from here: http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/

    If you have Windows 7 or Windows Server 2008 R2 then you still need to enable IIS Pass Through error handling because the fix for those OS””es will be available in SP1 of Windows 7 / Windows Server 2008 R2.

  2. ZHUZHU says:

    There are other choice factors which experienced been used on most winter jackets but most appear short when when in comparison with goose down. They are instead appreciably more high-priced which signifies that Moncler jackets build from goose decrease aren””t precisely cheap. many Hollywood stars choose Moncler for that great as appreciably as they do for that stylish styles that ensure it is stylish to develop to be observed in one. Winter could be fashionable, pleasurable if you individual the exceptional great decrease jacket like a Moncler jacket from the coloring and design of your choice.http://www.thomassabomarkt.com/ts36-thomas-sabo-necklaces.html

  3. Bunny says:

    TYVM you””ve solved all my probemls

  4. Chacidy says:

    What a pleasure to find someone who ientdiifes the issues so clearly

  5. Lonnie says:

    Asking questions are truly fastidious thing if you are not understanding anything totally, however this piece of writing
    presents fastidious understanding yet.

  6. Nuptials harmony is all a way out of taste. picking a enormous harmony using the trick out apparel or ceremonial is very transverse that you pulling of your commendation with out a hitch! There are very several completely different factors to some nuptial rites commendation ceremonial and nuptial rites commendation receipt which make sure it is perfect. The few should look in any way factors from the huge day time to be seized of the skilfulness to make certain which they have every little thing in readiness to go. just one this sort of crops that should unfold to be determined upon antecedent in the aim of specific commendation could haply be the sort of nuptial rites commendation harmony that will most in all verisimilitude be simple body from the day. The drawn out-boundary bride and servant will need to look at nuptial rites commendation Dressesmusic for equally the nuptial rites commendation ceremonial and nuptial rites commendation receipt.

Add a Comment