Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically create subdomains

Tags:

php

subdomain

dns

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!.

like image 493
johney Avatar asked Apr 28 '11 16:04

johney


People also ask

Can you create unlimited subdomains?

A subdomain is an addon to your primary domain with its unique content. It is a separate part of your website that operates under the same primary domain name without you purchasing a new domain. You can also create unlimited subdomains for every domain you own.

Do subdomains need DNS?

And you need to provide a pair of DNS name servers for your sub-domain. They need to serve the following records: a Start of Authority SOA record for the sub-domain. two or more NS records.

What is a wildcard subdomain?

Wildcard subdomain allows you to point all non-existing subdomains to a specific folder in your account. It means that if you enter different subdomains (which are not created in your cPanel) in your browser, they all will show the same content that you uploaded to the folder set for the wildcard subdomain.


1 Answers

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

like image 146
JohnP Avatar answered Oct 12 '22 06:10

JohnP