htaccess not forwarding for 404 errors

Discussion in 'Apache' started by Darden12, Apr 19, 2010.

  1. #1
    Can someone tell why the following htaccess file does not forward users to my notfound.html file when they key in a bad address?

    AddHandler Extension_Type .html .htm .php3 .php4
    
    Action Extension_Type /cgi-bin/php.dat
    
    Options -Indexes
    
    ErrorDocument 404 /notfound.html
    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ([^\.]+)$ index.php?FixedTitle=$1
    PHP:
    Thanks,
    B
     
    Darden12, Apr 19, 2010 IP
  2. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #2
    Try this.

    AddHandler Extension_Type .html .htm .php3 .php4
    Action Extension_Type /cgi-bin/php.dat
    Options -Indexes
    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ([^\.]+)$ index.php?FixedTitle=$1
    RewriteRule (.*) /notfound.html [L]
    PHP:
     
    proxywhereabouts, Apr 19, 2010 IP
  3. Darden12

    Darden12 Well-Known Member

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    I get an "internal server error" when I add that last line of code
     
    Darden12, Apr 19, 2010 IP
  4. showstopper

    showstopper Active Member

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    76
    #4
    try

    
    Options All -Indexes
    Options +FollowSymlinks
    RewriteEngine on
    
    AddHandler cgi-script .cgi .pl .html .htm .php3 .php4
    
    Action Extension_Type /cgi-bin/php.dat
    
    Options -Indexes
    
    ErrorDocument 404  /notfound.html
    ErrorDocument 403  /notfound.html
    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ([^\.]+)$ index.php?FixedTitle=$1
    
    Code (markup):
     
    showstopper, Apr 19, 2010 IP