Results 1 to 2 of 2

Thread: ErrorDocument in .htaccess not working

  1. #1
    Join Date
    Apr 2012
    Rep Power

    ErrorDocument in .htaccess not working

    I have added the ErrorDocument command to my htaccess file to use my own error pages but it is conflicting with one of the rewrite rules (second section below) and I just keep getting the default browser 404 error page. The rewrite condition line tells it to leave filenames alone and the url to my error page works perfectly when typed into a browser. Can anyone help?

    <Files .htaccess>
    order allow,deny
    deny from all
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    # 301 Redirect all requests that don't contain a dot or trailing slash to
    # include a trailing slash
    # except for form POSTS
    RewriteCond %{REQUEST_URI} !/$
    RewriteCond %{REQUEST_URI} !\.
    RewriteCond %{REQUEST_METHOD} !POST$
    RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

    # Rewrites urls in the form of /parent/child/
    # but only rewrites if the requested URL is not a file or directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ index.php?page=$1 [QSA]

    RewriteCond %{HTTP_HOST} !^www\.safari-club\
    RewriteRule (.*)$1 [R=301,L]

    ErrorDocument 404 /errordocs/error404.htm

  2. #2
    Thinkin' out loud again Builder's Avatar
    Join Date
    Nov 2002
    Rep Power
    Did you:
    Edit your .htaccess file in a text editor not a word processor?
    Add a few blank lines at the end of the file?
    Upload in ASCII (text) not Binary?
    Upload to the correct folder (i.e. htdocs if you want this to apply to your entire site)?

    Asking the "stupid questions" since usually when I have something go wrong it's because I did something that makes me slap my head and say "Well, duh..."

    Good luck,
    A good friend will come and bail you out of jail...
    but a true friend will be sitting next to you saying,
    "Damn... that was fun!"

Posting Permissions

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