How to 301 redirect a subdomain to a subfolder?

Discussion in 'Programming' started by Reviewz, Feb 4, 2009.

  1. #1
    Can someone point me to a proper coding to use in the htaccess file if I want to redirect a subdomain to a subfolder?

    Lets say I need to redirect:

    http://testpage.mysite.com

    to

    http://mysite.com/subdomain/testpage


    What rule to use? Also, do I need to delete the directory (folder) of testpage in the cPanel - public_html directory, or can I leave it there (it has its own htaccess file that might interfere).

    Thanks.
     
    Reviewz, Feb 4, 2009 IP
  2. NuLLByTe

    NuLLByTe Active Member

    Messages:
    382
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    80
    #2
    NuLLByTe, Feb 4, 2009 IP
  3. Reviewz

    Reviewz Peon

    Messages:
    601
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Reviewz, Feb 4, 2009 IP
  4. NuLLByTe

    NuLLByTe Active Member

    Messages:
    382
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    80
    #4
    Try
    
    Redirect 301 http://testpage.mysite.com/ http://mysite.com/testpage/
    
    Code (markup):
     
    NuLLByTe, Feb 4, 2009 IP
  5. th3sn0wbr4in

    th3sn0wbr4in Guest

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I think it can be configured via cPanel.
    When you create or modify subdomain via cPanel
    you'll have option to redirect and to determine rootdir domain.
     
    th3sn0wbr4in, Feb 5, 2009 IP