htaccess Subdomain Redirect

Discussion in 'Apache' started by metalik, Jul 16, 2008.

  1. #1
    Hi guys,

    I just want to redirect the subdomain to index.php file, any help needed asap.

    e.g: sub.mydomain.com => mydomain.com/index.php?sub=sub
    all: *.mydomain.com => mydomain.com/index.php?sub=*

    Thanks!
     
    metalik, Jul 16, 2008 IP
  2. EH Justin

    EH Justin Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are you looking for a wildcard redirect (Something that would work no matter what subdomain is created?), or are you willing to create a new .htaccess file for each subdomain that you create?
     
    EH Justin, Jul 16, 2008 IP
  3. wattie

    wattie Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I guess the first variant. If your DNS server supports wildcard then it's possible with one .htaccess in the website root, however I have no possibility to write one and test at the moment (maybe other member can help).

    P.S. It also depends on the web server configuration and how it handles subdomains - sometimes they are combined subfolders/subdomains (like in DirectAdmin cp for example), which will make the things easier for setup
     
    wattie, Jul 16, 2008 IP
  4. metalik

    metalik Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yes, i am looking for a wildcard redirect(Something that would work no matter what subdomain is created?)
     
    metalik, Jul 16, 2008 IP