.htaccess for 404 not found error

Discussion in 'PHP' started by aayybb, Sep 29, 2009.

  1. #1
    Hi,

    I would like to redirect all not found error 404 to a product.html in subdirectory test.
    I had tried having a .htaccess in /test/ which has

    ErrorDocument 404 /notfound.html

    I also have /test/notfound.html (below) to handle redirect.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <meta http-equiv="Refresh" content="2; URL=www.sample.com/test/product.html">
    <title></title>
    </head>

    <body>

    </body>
    </html>

    Both .htaccess and product.html are in /test/ directory.

    Somehow this doesn't work.
    I also tried to have this 2nd version of .htaccess

    ErrorDocument 404 /test/notfound.html

    Anyhow, I don't have any luck. I wonder if any body can point out my mistake. Thanks in advance.
     
    aayybb, Sep 29, 2009 IP
  2. aayybb

    aayybb Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    aayybb, Sep 29, 2009 IP