9

I want to dynamically create new sub domains on my website. i mean if you have example.com then you dynamically create sub.example.com .

i looked on google and there was nothing really good. i downloaded some scripts but they were all not working. my website is based on php so please if there is anyway i can do it in php tell me, and also if it can be possible with python then that is awesome!.

johney
  • 119
  • 1
  • 1
  • 3
  • 1
    possible duplicate of [How to let PHP to create subdomain automatically for each user?](http://stackoverflow.com/questions/183928/how-to-let-php-to-create-subdomain-automatically-for-each-user) – Shakti Singh Apr 28 '11 at 16:48

2 Answers2

20

You need to setup a wildcard subdomain. Basically, anything.mysite.com will resolve to mysite.com. At that point it's up to your code to kick in and serve up the proper content depending on what subdomain the user is looking at.

http://www.google.lk/search?q=wildcard+subdomain

JohnP
  • 49,507
  • 13
  • 108
  • 140
-3

You can't do this unless you have permission to alter the DNS server for your domain.

Mike Thomsen
  • 36,828
  • 10
  • 60
  • 83