Redirect from sub folder to main domain

Discussion in 'Apache' started by tnk, Mar 18, 2009.

  1. #1
    Hi

    I need some help and would really appreciate it as I find it very tricky. I have a website which is currently redirected to a subfolder

    Eg: domain-.com/subfolder

    Now I dont want it to goto subfolder but since its and old site many people have bookmarked articles with /subfolder

    I have already organized my code under main domain-.com

    So I wanted to redirect anyone visiting domain-.com/subfolder/xyz to domain-.com/xyz so I wrote the following code which does not seem to work
    RewriteRule /sub-folder/(.*) /$1 [R=301,NC,L]
    
    Code (markup):

    So if you request /subfolder/foo.html
    you will be told that the page has moved permanently to
    /foo.html

    Is there something wrong with this ? Can you help ?

    Thanks a lot.
     
    tnk, Mar 18, 2009 IP
  2. rathin

    rathin Peon

    Messages:
    1,377
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    u haveing cpanel server?
     
    rathin, Mar 21, 2009 IP
  3. tnk

    tnk Active Member

    Messages:
    277
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    68
    #3
    yes, its cpanel server
     
    tnk, Mar 21, 2009 IP