404 error redirection issue (htaccess)

Discussion in 'HTML & Website Design' started by TedMaster, Nov 13, 2012.

  1. #1
    So I've created a .htaccess file with only this line of code:

    ErrorDocument 404 /lost.html

    And uploaded it to the root of my website.

    Now this works fine when typing a non-exsistant address in the root of my website:
    www.aptitude-test.com/funky.html - which is non-exsistant - redirects to www.aptitude-test.com/lost.html

    However, when I type a non-exsistant address within a subfolder it redirects incorrect:
    www.aptitude-test.com/funky/funky.html- which is non-exsistant - redirects to www.aptitude-test.com/funky/lost.html - which is non exsistant

    Is there anyway to force the redirection to www.aptitude-test.com/lost.html for all 404's?
     
    TedMaster, Nov 13, 2012 IP
  2. Jekwueme

    Jekwueme Greenhorn

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #2
    have you tried using the full domain on the query?
     
    Jekwueme, Nov 14, 2012 IP
  3. GMF

    GMF Well-Known Member

    Messages:
    855
    Likes Received:
    113
    Best Answers:
    19
    Trophy Points:
    145
    #3

    Well, you have to use absolute paths for your 404 site. I stumbled upon this problem myself, but using absolute paths fixed it.
     
    GMF, Nov 14, 2012 IP
  4. wizardofx

    wizardofx Well-Known Member

    Messages:
    572
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    140
    #4
    That is what I was just about to suggest. What is happening is that the browser is going back just
    one level with the /

    If you use the full URL you will get what you want.

    wiz
     
    wizardofx, Nov 14, 2012 IP
  5. TedMaster

    TedMaster Member

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    I see, it works now. I removed the / and simply typed in the full URL. It was that simple.

    Thank you!
     
    TedMaster, Nov 15, 2012 IP