htacess redirection question

Discussion in 'Programming' started by -MGS-, Feb 22, 2010.

  1. #1
    Hey guys,

    Sorry for such a noobies question - I would classes myself as knowledgeable in these kinds of area, but not when it comes to htacess.

    I am using the following htacess within a site:-

    Redirect 301 /folder http://www.site.com/

    But what its not doing is redirecting urls such as

    www.site.com/folder/images/index.html

    As the root does not work (all files moved)

    is there a was to make anything that has been put after /forum/ to redirect to the top level domain?
     
    -MGS-, Feb 22, 2010 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi,use:
    RedirectMatch 301 /folder(.*) http://www.site.com/$1
    Code (markup):
    p.p.: folder or /folder not sure (with or without slash) but must works.
    :)
     
    koko5, Feb 22, 2010 IP
  3. -MGS-

    -MGS- Well-Known Member

    Messages:
    283
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Hey,

    I have used that code but what is does is:-

    Redirects the /folder

    But if I go to /forum/images/index.html (which no longer exists)

    it redirects me to www.mysite.com/images/index.html

    Thanks

    Dan
     
    -MGS-, Feb 23, 2010 IP
  4. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #4
    Just append ErrorDocument 404 /"desired file|folder "
    OR
    place a separate .htaccess in /forum/ which will handle this.
    :)
     
    koko5, Feb 23, 2010 IP