Customizing AskApache Google 404

In an effort to utilize my Google Custom Search Engine (CSE), I turned to the AskApache Google 404 plugin. It’s a great plugin. If someone comes to your site using an outdated URL, such as cainmanor.com/tunafishsandwich, it will drop you to a search page, giving you the option to search google, my custom search engine or my blog for “tunafishsandwich OR cain manor.” As handy as it was, it didn’t quite meet my needs. I had to change a few things to get it to work for me.

I saw no need for Cain Manor to search for video, blogs, or images. From the plugin page ( Options – AA Google 404 – lower pane) I removed

searchControl.addSearcher(new GblogSearch());
searchControl.addSearcher(new GvideoSearch());
searchControl.addSearcher(new GimageSearch());

The default plugin give you an option to search the AskApache site. I appreciate the effort the author put into this plugin, but it’s not relevant that his site be searched from mine. To fix this, you must put in your own Google AJAX Search API. There is a link to get your own API Key from Google from the homepage. Once you’ve changed out the key, you also need to edit this line, putting in the name of your CSE as desired.

customEngineSearch.setUserDefinedLabel(“WOW Search”);

Lastly, and most annoyingly, the default search option is to search for your blog name and your URI. For example, if you searched for cainmanor.com/tunafishsandwich, the search options would be for “cain manor OR tunafishsandwich.” To remove that item, edit aa-google-404.php (found in /wp-content/plugins/aa-google-404.) Change

$aa_execute=$aa_label.’ OR ‘.basename($_SERVER[‘REQUEST_URI’],’.html’);
to
$aa_execute=basename($_SERVER[‘REQUEST_URI’],’.html’);

Your search will now be generated from your failed URI Only

This is a great plugin, but there wasn’t a lot of documentation on how to configure it to my needs. I hope this can save someone else time.

One Comment

  1. Pingback: my .htaccess | Cain Manor

Comments are closed.