Results 1 to 6 of 6
  1. #1
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    404 Pages
    When I make a site I always try to make a custom 404 page. I add the following line to my .htaccess file.

    ErrorDocument 404 /404.html

    In my case I create a 404.php file.

    Recently I noticed when my custom 404 page loads the URL in the address bar still is pointing to a page that does not exist. This is where my question(s) come in.

    If the URL still points to a missing page, does that then allow a missing page to be indexed? If so is it bad from an SEO perspective? Finally, is there a correct way to setup a custom 404?
    Thanks,
    Doug

  2. #2
    ABW Ambassador ladidah's Avatar
    Join Date
    October 15th, 2007
    Location
    MA
    Posts
    1,888
    If your page is not there or do not exist, it can't be indexed.

    Do a site:www.example.com search and you can see which pages are indexed.

    Your statement for a 404 is correct for your html pages, but for your php are you trying to do a 404 for a blog? If so, make sure your .htaccess is in the directory you have your blog. Even if it's pointing to the missing page, (and redirecting to the custom page), does it show your custom page as result? If so, that should be fine.

  3. #3
    Lite On The Do, Heavy On The Nuts Donuts's Avatar
    Join Date
    January 18th, 2005
    Location
    Winter Park, FL
    Posts
    6,930
    If you're using a page called "404.php", you should use:
    ErrorDocument 404 /404.php

    If you're using dynamic url rewriting, don't assume your ErrorDocument call will be processed by your htacess rewriting scheme. Make sure you test it.

    Another important point, the leading slash in this htaccess statement matters a lot.
    These work:
    ErrorDocument 404 /404.php
    ErrorDocument 404 /404.html
    ErrorDocument 404 /resources/404.php
    These don't:
    ErrorDocument 404 404.php
    ErrorDocument 404 404.html
    ErrorDocument 404 resources/404.php
    In most webpage references (aka urls), the server can interpret relative and absolutive urls and even correct a missing slash or incorporate the base href tag, with and without a leading slash - but within htacess error doc specifications, normal url processing pathways are almost always different than the usual url handling that the server uses.
    Further, this won't work either:
    ErrorDocument 404 http://www.mydomain.com/404.html
    The way apache works is that a redirect will happen to that page, the "404.html" page, a page which does exist, so a 404 code won't be generated.

    For seo purposes, you want your 404 page to do two things:
    +deliver a 404 reply
    +have content to help your visitors find their way

    To make sure the proper code is generated, view the http header reply by trying to reach a page on your site that doesn't exist. There are many ways to do this, here's one way:
    1) Visit http://www.***anfinder.com/urlinfo/
    [note - this forum removes the letters f a g and puts * in their place]
    2) In the box at the top, enter the url for a page at your site that doesn't exist, something this (so when you see it in your logs, you can see it was you):
    http://www.mydomain.com/donuts-is-a-stud.html
    3) Click the "Develop" tab (far right side, next to last tab).
    4) Click "View HTTP" function below the tab, 2nd row, far right. This function shows you the returned HTTP Header, nice online tool, no download or ads.

    Then inspect the results making sure the 404 code was returned.

    It should say something like this:
    HTTP Status Code: HTTP/1.1 404 Not Found

    Below that, you can also see what is being served up for the visitors eyeballs when they've reached a bad url.

    I like to tell them they're reached a bad page and give them my site map details. A scheme to help them is vitally important to retaining your hard earned traffic.

    And today's search engines will visit your website, toss a nonsense url at your server and look for these two things, the proper 404 code beiong served up along with inspecting the content you present to these lost visitors.

    ~~~~~~~~~~~~~~~~~~~~~
    One more point, for dynamic sites...

    The page you're on here, right now, is:
    http://forum.abestweb.com/showthread.php?t=108221

    If you go view the HTTP Header tool I linked to above and try to visit this page:
    http://forum.abestweb.com/showthread...-is-a-stud.php

    You will see that Haiko has his server configured properly to deliver the 404 response code. The content he puts up is a graphic letting the user know they've reached a bad page. He might improve things by adding a site map there, but what he has is working properly and is just fine.

    Now, to the dynamic part... what if I try to visit this url:
    http://forum.abestweb.com/showthread...nuts-is-a-stud

    Haiko has it set to deliver a "No Thread specified" error and this page returns a 200 status code (page found). Whether you return a 404 code with a notice, or a 200 code with a notice, if you're using dynamic pages, do something like Haiko has done here - anticipate both incorrect urls and incorrect dynamic url variables and handle them in ways you judge best for your site.
    Last edited by Donuts; July 24th, 2008 at 11:33 AM. Reason: Haikos has forum set to autoreplace the letters "***", added note

  4. #4
    ABW Ambassador 2busy's Avatar
    Join Date
    January 17th, 2005
    Location
    Tropical Mountaintop
    Posts
    5,636
    And today's search engines will visit your website, toss a nonsense url at your server and look for these two things, the proper 404 code beiong served up along with inspecting the content you present to these lost visitors.
    I saw one of those yesterday in my access logs and wondered what the heck it was. http://www.mysite.com/unspecified and it brought up the 404 page. Thanks, Donuts!

  5. #5
    Lite On The Do, Heavy On The Nuts Donuts's Avatar
    Join Date
    January 18th, 2005
    Location
    Winter Park, FL
    Posts
    6,930
    G's feeler usually has nonexistant or something like that within the nonsense url they toss at you.

    If you use G's Webmaster Tools, they also take you through a process where you post a page on your site with a long name and they bang it to verify the person with the google account who says they own the site, can post the page (and empty file) on the site, figuring if you can edit the site, you own it or have rights to use tools on it. Those Webmaster Tools are free and they're pretty decent - will show you details about crawling and indexing that you can't get elsewhere, keywords and rankings, robot'txt checker, crawl stats and more. The G crawler will swing by, bang that long named empty page to re-verify the webmaster tools account holder is still correct and then they often turn around a second or two later and toss that same name at you with the words noexist added to that long name, to check your 404 code response and to see what content you serve up to visitors who whack a bad url. If they check for it, you ought to think about making it perform optimally as a webmaster.

    Many people have a custom page that loads when a 404 page is needed, but they forget to maintain the 404 status code (by using htacess in a LAMP/Apache environment) for that page - G doesn't like that.

    By the way, that online http header and content viewer that I linked to is a great tool for many other things that pertain to webmastering and affiliate marketing. I suggest every pro needs an onlne http header viewer bookmarked for use for various reasons (like the 404 status code). That particular one has many other tools on the various tabs, a nice tool for any aff's quiver.

  6. #6
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    I had the .htaccess set to:

    ErrorDocument 404 /404.php

    I used that site and it looks like I am doing everything corectly.

    A wealth of knowledge! Thanks for the great reply Donuts.
    Thanks,
    Doug

  7. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Featured: How to Deal with 404 and 302 Error Pages
    By Packy in forum Programming / Datafeeds / Tools
    Replies: 7
    Last Post: September 26th, 2013, 03:10 PM
  2. Anybody Have Cool 404 Pages?
    By Trust in forum Midnight Cafe'
    Replies: 7
    Last Post: October 5th, 2011, 07:45 PM
  3. Google Beta Tool Bar & 404 Error Pages
    By glittered in forum Midnight Cafe'
    Replies: 8
    Last Post: February 18th, 2008, 03:31 AM
  4. Programming 404 pages from expired blog entries
    By Rhia7 in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: July 26th, 2007, 02:10 AM
  5. 404 pages
    By davidh in forum Programming / Datafeeds / Tools
    Replies: 5
    Last Post: June 12th, 2007, 10:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •