404 Redirection in .htaccess file?

Discussion in 'PHP' started by klubz, Jun 1, 2008.

  1. #1
    Hi,

    Having looked on the internet for help here, I thought I have this mastered...But I haven't.

    I am looking to redirect all the 404 errors to another page which I created called redirect.htm.

    I have added the following line to the .htaccess file:
    ErrorDocument 404 /redirect.htm
    This should popup two sites...

    The domain is megatorg.com

    Any ideas would be much appreciated

    Thanks...
     
    klubz, Jun 1, 2008 IP
  2. mehmetm

    mehmetm Well-Known Member

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #2
    try that

    ErrorDocument 404 http://www.yoursite.com/redirect.htm
     
    mehmetm, Jun 1, 2008 IP
  3. klubz

    klubz Active Member

    Messages:
    150
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    IT WORKED...! Thanks
    I had: ErrorDocument 404 /redirect.htm
    This didn't work for some reason but this was the advise I was given from various other sites...Thanks...
     
    klubz, Jun 1, 2008 IP
  4. mehmetm

    mehmetm Well-Known Member

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #4
    your welcome ;)
     
    mehmetm, Jun 1, 2008 IP
  5. Debt Reduction

    Debt Reduction Peon

    Messages:
    248
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Is there any other way of redirection other than htaccess method.....

    please reply me fast m having serious problem....
     
    Debt Reduction, Nov 3, 2008 IP
  6. LawnchairLarry

    LawnchairLarry Well-Known Member

    Messages:
    318
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    118
    #6
    The reason it did not work is the forward slash (/), which you should have omitted if you only mention the path, instead of the full URL. Like this:
    ErrorDocument 404 redirect.htm
    Code (markup):
    Anyhow, glad you sorted it out, because .htaccess files can be quite a pain.
     
    LawnchairLarry, Nov 4, 2008 IP