Redirect all subdomains to subfolders

Posted by alfonso on Server Fault See other posts from Server Fault or by alfonso
Published on 2012-07-06T23:25:39Z Indexed on 2012/07/07 3:17 UTC
Read the original article Hit count: 141

Filed under:
|
|
|

I'd like to add a rule so that all subdomains get redirected to a subfolder. For example:

app1.example.com -> example.com/app1
app2.example.com -> example.com/app2
something.example.com -> example.com/something

All subdomains will only be one level deep.

Questions

  • Which DNS providers allow me to do this?
  • Are these alternatives feasible?
    • Redirect them all to a special webapp with a static IP that redirects to the proper subfolder. How can I know from which subdomain they came from?
    • Programatically create each rule when I need it. Which DNS providers have API access to add rules? I think Amazon Route 53 might be the answer here.

© Server Fault or respective owner

Related posts about dns

Related posts about subdomain