.htaccess 404 redirection - Looking for Help

Discussion in 'HTML & Website Design' started by -Aw-, Apr 20, 2010.

  1. #1
    Hey guys,

    I just wanted to know if there is a way I could do this algorithm. It deals with redirecting a page to a page in a folder of the same name in case of a dead page (404).

    1.) If the page loads correctly, do nothing.
    2.) If the page has a 404 error in http://www.domain.com/XXXXX, redirect it to http://www.domain.com/forum/XXXXX. XXXXX is often subsituted as $1 from what I know.
    3.) if http://www.domain.com/forum/XXXXX is a dead link, redirect it to a 404 page.

    Thanks guys.
     
    -Aw-, Apr 20, 2010 IP
  2. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    1. obvious
    2. it's possible
    3. you'll need to do this checking from within the forum application if you have all URLs rewritten to its handler or if you mean like /forum/LOLLLLL.exe---hi/rrr
     
    krsix, Apr 20, 2010 IP
  3. blacksheep666

    blacksheep666 Active Member

    Messages:
    68
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #3
    put this on your htaccess

    ErrorDocument 404 forum/XXXXX
     
    blacksheep666, Apr 21, 2010 IP
  4. -Aw-

    -Aw- Active Member

    Messages:
    319
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #4
    Um, alright?

    Thanks for trying, but it doesn't seem to work.
     
    -Aw-, Apr 21, 2010 IP
  5. blacksheep666

    blacksheep666 Active Member

    Messages:
    68
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #5
    are you sure its not working? because it does work in mine.

    can you show me your htaccess?
     
    blacksheep666, Apr 21, 2010 IP
  6. -Aw-

    -Aw- Active Member

    Messages:
    319
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #6
    Is XXXXX a variable? Because I will need that.
     
    -Aw-, Apr 22, 2010 IP
  7. blacksheep666

    blacksheep666 Active Member

    Messages:
    68
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #7
    forum/XXXXX is a url... you can also put a variable on that.
     
    blacksheep666, Apr 22, 2010 IP