Redirect Directory on One Domain to Subdomain on Different Domain

Discussion in 'Site & Server Administration' started by mrtbc, Mar 17, 2009.

  1. #1
    I need to redirect all URLS relating to a subdirectory on one domain to a subdomain on another domain, e.g.

    http://www.domainone.com/directory/anythingatall

    Should be redirected to:

    http://subdomain.domaintwo.com/anythingatall

    This needs to work for:

    http://www.domainone.com/directory/somethingelse
    http://www.domainone.com/directory/anythingelse
    etc.

    Please note that the directory needs to be removed from the first domain and the subdomain needs to be added to the second domain.

    Can this be achieved using .htaccess please?

    Thanks very much for your help.
    :)
     
    mrtbc, Mar 17, 2009 IP
  2. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #2
    You can redirect using following way:

    Redirect 301 /directory/anythingatall http://subdomain.domaintwo.com/anythingatall

    Same way you can redirect your other URL.

    Put this line in the .htaccess file of domainone.com.

    Kailash
     
    kailash, Mar 19, 2009 IP