Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2009
    Thanked 1 Time in 1 Post

    htaccess 404 not redirecting sub directories

    Hi all I am using the following code in my htacccess file which redirects 404s to my custom 404 page:

    ErrorDocument 404 /404.php
    This works perfectly when the link is www.mysite.com/nothinghere.html

    however when the site is www.mysite.com/nothing/here.html

    or any further amount of subdirectories it does not work.

    Here is my complete htaccess file in case it is one of the other rules causing this problem (which I think it might be):

    #--- DH-PHP handlers ---
    AddHandler fastcgi-script fcg fcgi fpl
    AddHandler php-fastcgi .php
    Action php-fastcgi /cgi-bin/dispatch.fcgi
    # Begin Ultimate SEO V2.2d 
    Options +FollowSymLinks
    RewriteEngine On 
      # RewriteBase instructions 
      # Change RewriteBase dependent on how your shop is accessed as below. 
      # http://www.mysite.com = RewriteBase / 
      # http://www.mysite.com/catalog/ = RewriteBase /catalog/  
      # http://www.mysite.com/catalog/shop/ = RewriteBase /catalog/shop/ 
      # Change the following line using the instructions above  
    RewriteBase /
    RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}
    RewriteRule ^(.*)-po-([0-9]+).html$ pollbooth.php?pollid=$2&%{QUERY_STRING}
    # End Ultimate SEO V2.2d
    ErrorDocument 404 /404.php

  2. #2
    Regular Coder
    Join Date
    Jan 2009
    Thanked 1 Time in 1 Post
    I am mistaken. It is actually working. The problem is the style sheets are not attaching correctly because they are relative to the site root.

    annnd fixed... needed a base href tag on the page..
    Last edited by ShaneC; 01-22-2011 at 09:59 PM. Reason: Posted Merged


Posting Permissions

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