If you're new here, you may want to subscribe to my RSS feed. So that you can read the latest updates about Web2.0 tools, Making Money Online, Tips in SEO, Ajax and many more. Thanks for visiting ProgramimiCOM!

Hopefully you’ve played around with some HTML when you were building your custom 404 error page, as explained in our tutorial on creating your custom 404 error page , in which case this will be a breeze.

If not, it’s time to roll up your sleeves and get ready to do some coding!

Step One: Identifying your 404 error page

The first step is to figure out which page is your custom 404 error page.

Most likely you’ve just built it, so that’s a very simple step, but if not, identify your httpd.conf file, then find the line therein that looks like this:

ErrorDocument 404 /errordoc-404.shtml

That’ll tell you what file is your 404 error page.

Step Two: Open up the file for editing

There are dozens of different Web page and HTML editors on the market, so your process will likely be different to what we use, but hopefully you have a tool like Homesite, BBEdit, or even vi or EMACS to edit the file and can do so directly. If not, you might need to download the HTML file from your server to your local computer then open it with a simple editor like NotePad (on Windows) or TextEdit (on the Macintosh) to proceed.

Step Three: Copy and paste this code

Now the fun part: copy the following lines of HTML and paste them directly into your custom 404 error page:

<form action=”http://www.google.com/search” name=”searchbox”
method=”get” style=”margin-left: 2em;” />
<input type=”hidden” name=”hl” value=”en” />
<input type=”hidden” name=”ie” value=”ISO-8859-1″ />
<input type=”hidden” name=”sitesearch” value=”programimi.com” />
<input maxlength=”256″ size=”40″ name=”q” value=”" />
<input type=”submit” value=”find it” name=”btnG”
style=”font-size:75%;” />
</form>

You need to change the domain name from programimi.com to your own domain, but that’s the only customization required. Save the changes and upload the new version of the file if needed.

Step Four: Testing

Once you’ve saved your new custom 404 error page, generate a page by hitting a link like http://www.example.com/badpage and looking for the form.

That’s all there is to it. You now have a lovely Google search engine that constraints itself automatically to a search of your pages only. Now you should ensure that Google knows about your site and you might also want to fix spelling problems too. :-)