20 Jul
Posted by ProCOM
on July 20, 2007 – 9:40 pm - 261 views
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!
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.
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.
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.
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. :-)
Print This Post
Email This Post
One Response
How to Create Your Own 404 Error Page Using .htaccess
August 26th, 2007 at 9:47 pm
1[…] succinct and dry to the peculiar, to the witty, to the super-helpful (for example, you can easily add a google search for only pages from your site to your 404 error page […]
Comments RSS
TrackBack Identifier URI
You must be logged in to post a comment.