Submit Your Article Forum Rules

Results 1 to 5 of 5

Thread: Frustrating 404.shtml issue with Dreamwweaver sites

  1. #1
    Senior Member AuctionHugh's Avatar
    Join Date
    Jul 2004
    Posts
    202

    Question Frustrating 404.shtml issue with Dreamwweaver sites

    We develop websites and make pretty decent ones, primarily for small business folks. We develop using dreamweaver 5.0 currently. When we set up the site, we choose Site Setup - Advanced Settings - Local Info - Links Relative to Site Root. We host our sites at Bluehost.

    My 404 pages seem to work find when the not found page is in the site root, for example:
    http://www.wmlawnservices.com/exampl...stant-page.htm

    But if the page not found is in a subfolder, the 404.shtml page internal links are all a mess:
    http://www.wmlawnservices.com/Kalamazoo-Portage-Sprinkler-Lawncare/subfolder-page-that-does-not-exist.htm

    I am taking an existing page and saving-as to create the 404. With relative to site root that should work fine, but it is not.

    Anyone help me figure this out?
    Last edited by AuctionHugh; 07-04-2012 at 08:57 PM.

  2. #2
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,793
    I'm presuming you want something like this... /error/message.php. Then the page can parse out the error code and supply the appropriate response (for 404, 403, 410, etc.).

    To make this work you need to configure directives so the server can point to your custom error handling page, rather than Apache's.

    Code:
    .htaccess
    
    ErrorDocument 403 /error/message.php?err=403
    ErrorDocument 404 /error/message.php?err=404
    Your SHTML page would have something similar to this (PHP) example:

    PHP Code:

    $theDocument = $_SERVER['HTTP_HOST'] . $_SERVER['REDIRECT_URL'];
    $theError = isset($_REQUEST['err']) ? $_REQUEST['err'] : null;
    $theError = intval($theError);
    .
    .
    .
    <p>The document<?php
     
    echo ", <strong>$theDocument</strong>, ";
     echo ((
    $theError !== 403) ? "could not be found on the server" "is forbidden") . ".";
     
    ?></p>
    Last edited by weegillis; 07-05-2012 at 01:32 AM. Reason: correction

  3. #3
    Senior Member AuctionHugh's Avatar
    Join Date
    Jul 2004
    Posts
    202
    My server defaults to the equivalent of this in .htaccess: ErrorDocument 404 /404.shtml - when I add that line to .htaccess I get the same results as without it.

    When you go to a not found page in the root folder, http://www.wmlawnservices.com/whatever.htm for example, the correct 404.shtml page displays which is a basic html document created from the dreamweaver template.

    However if a bad pagename is called within a folder, the same 404.shtml is displayed, but none of the graphics display and the paths in the menu items are wrong. I can't have this clickable or google will index the error here but it is like this example:
    http://www.wmlawnservices.com/Kalamazoo-Portage-Sprinkler-Lawncare/whatever.htm - paste into your browser address bar and you will see what I mean.

    If dreamweaver is set up to make all paths relevant to the root, this should not be happening. I think it is a dreamweaver error but I might be wrong. Are others experiencing this?
    Last edited by AuctionHugh; 07-05-2012 at 09:43 AM.

  4. #4
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,793
    Change the path to your images from "images/.." to "/images/.." and your problem will go away. Don't forget the menu images, as well: '/images/..'

  5. #5
    WebProWorld MVP DaveSawers's Avatar
    Join Date
    Dec 2006
    Location
    Lunenburg, Nova Scotia, Canada
    Posts
    760
    Quote Originally Posted by AuctionHugh View Post
    If dreamweaver is set up to make all paths relevant to the root, this should not be happening.
    That is exactly what DW is doing and that's why it doesn't work. Since you are in a subdirectory and the images on the 404 page are relative to the root not the subdirectory, then they won't be found. Weegillis has the correct solution which only needs to be applied to your 404 page.
    Dynamic Software Development
    www.activeminds.ca

Posting Permissions

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