[htaccess Help] Redirect to Error Page > NOT Homepage

Discussion in 'Apache' started by antman, Mar 21, 2007.

  1. #1
    Hi,

    I want to know how to redirect anything from

    domain.com/RNWAWFKNAL [something random]

    to a error page, instead of my homepage as it redirects automatically.

    This is for the instances of folders.

    Thanks :)
     
    antman, Mar 21, 2007 IP
  2. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #2
    Set up a 404 error page.
     
    Richie_Ni, Mar 21, 2007 IP
  3. antman

    antman Well-Known Member

    Messages:
    1,907
    Likes Received:
    106
    Best Answers:
    0
    Trophy Points:
    130
    #3
    I have, as I said above, this is for folders, not images etc.
     
    antman, Mar 21, 2007 IP
  4. Your Content

    Your Content Banned

    Messages:
    1,096
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Add to your .htaccess a redirection directive like this

    
    
    
    Redirect permanent /folder1  http://new-location/error_page
    
    Redirect permanent /folder2  http://new-location/error_page
    
    Code (markup):
    etc, etc.
     
    Your Content, Mar 21, 2007 IP
  5. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #5
    lol,that will be a lot of work....

    I think 404 error page works for them too as long as they are not existent?
     
    Richie_Ni, Mar 21, 2007 IP
  6. antman

    antman Well-Known Member

    Messages:
    1,907
    Likes Received:
    106
    Best Answers:
    0
    Trophy Points:
    130
    #6
    Yes, this would be impossible. I'm trying to cover all folders that don't exist.

    Nah :( Only for images at the moment for my site.
     
    antman, Mar 21, 2007 IP
  7. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #7
    The default behaviour is to show a 404 page whenever anything (files and folders) is requested that does not exist. It sounds like you already have some htaccess rules or similar that is interfering and redirecting to the homepage. If that's nothing you know about, I'd suggest contacting your host and checking its not anything to do with them.
     
    rodney88, Mar 21, 2007 IP
  8. antman

    antman Well-Known Member

    Messages:
    1,907
    Likes Received:
    106
    Best Answers:
    0
    Trophy Points:
    130
    #8
    The host contacted me to look up something to do with htaccess, so that's why I'm asking :)
     
    antman, Mar 21, 2007 IP
  9. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #9
    If you request a file or directory that does not exist, your server will give a 404 error page unless you've told it to do otherwise. There is no sensible way of making it show the 404 page instead of redirecting to the homepage, other than removing whatever is already in place that's causing it to redirect.
     
    rodney88, Mar 21, 2007 IP
  10. antman

    antman Well-Known Member

    Messages:
    1,907
    Likes Received:
    106
    Best Answers:
    0
    Trophy Points:
    130
    #10
    Problem fixed. I removed RewriteEngine On from the script.

    Thanks anyway.
     
    antman, Mar 21, 2007 IP