Hi all...
I plan to develop a Free Domain Name Service like .co.cc.
Actualy it's a free subdomain service.
For example, I use: xxx.tld.

Now,
1. how to create a subdomains (or virtual subdomains) using PHP+Mod Rewrite? Example: thedomain.xxx.tld
I mean, how to write it on .htaccess file using PHP? fwrite("...", w+);
2. How to make: the virtual subdomain can be added to different server using name server like .co.cc did? Example: ns1.otherserver.com and ns2.otherserver.com

Thank you.

that's a server function called cname. Most hosts support cnames.
Ask them how to set it up on yours or check their FAQ.

I have the access to WHM, so i can configure DNS.
I added this:

* IN 14400 IN A my_ip_addres_follwed_with"."

If this is solved than please click the solved button but if it's not then continue reading...
The only 2 ways I have known php to create subdomains is 1 - by getting php to edit the apache config file which I wouldn't recommend. The second option is to create a wildcard subdomain pointing the wildcard subdomain to a php script which can then process the actions.

not solved yet, the above step does not work. have u any idea?

Did you create a wildcard subdomain and make the php script sort the subdomains? for example the subdomain of example.com would be *.example.com

I did it.

* IN A xxx.xxx.xxx.xxx. // accepted by WHM
* IN CNAME domain.tld // rejected by WHM

Then the .htaccess file contains these lines bellow:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.tld$ [NC]
RewriteRule ^.*$ - [L]
RewriteCond %{HTTP_HOST} ^(.*?)\.(www\.)?domain\.tld$ [NC]

No htaccess is needed for that wildcard domain but instead a single php file. You will be able to retrieve the subdomain entered with the $_SERVER; variable. So the user can enter any subdomain then the php script will receive it in that variable and you can preprocess it.

I'll try your nice suggestion, thanx mate...
Does it work like .co.cc?
Please read my case from the begining.

It works on any domain but are you trying to get wildcard tld's? Because the Top level domain (eg. .co.cc) cannot be changed automatically unless you have registered all combinations. But for subdomains it's a completely different story. If your trying to create infinit combination subdomains then my previous post describes how to do that.

I'll try your nice suggestion, thanx mate...
Does it work like .co.cc?
Please read my case from the begining.

It works on any domain but are you trying to get wildcard tld's? Because the Top level domain (eg. .co.cc) cannot be changed automatically unless you have registered all combinations. But for subdomains it's a completely different story. If your trying to create infinit combination subdomains then my previous post describes how to do that.

FYI, actualy co.cc is not tld. The extension is .cc, and co is the domain. They offer free subdomain service.
That's why no external WHOIS for .co.cc.
That's why I'm hard to find subdomain solution on the net. Hopeful I'll find it here.

From Allwhois.com:

Domain Name : co.cc

:: Registrant, Administrative Contact, Technical Contact ::
Name : JONG SUNG, KIM
Email : katoffel@nate.com
Address : 864-2, JANGHANGDONG, ILSAN, GOYANG,GYEOUNGGI
Zipcode : 410837
Nation : 
Tel : +82.319196171
Fax : +82.319196150

::Name Servers::
ns.co.cc 
ns1.co.cc 
ns2.co.cc 
ns3.co.cc 

::Dates & Status::
Created Date : 1997/10/13 00:00:00 EST
Updated Date : 2010/01/11 12:54:46 EST
Valid Date : 2019/08/18 00:15:07 EST

FYI, actualy co.cc is not tld

That is incorrect because a friend of mine has a domain named obvioussiteisobvious .co.cc and so two people can't have the same domain or did you give my friend a subdomain?

Where he bought it?
and where can I check his whois neither in co.cc local whois?

I checked it on .co.cc's local whois:
http://www.co.cc/whois/whois.php

Domain Name : obvioussiteisobvious.co.cc
Registrar : CO.CC, INC.
Whois Server : co.cc
Referral URL : http://www.co.cc
Name Server : NS1.CWARN23.INFO
Name Server : NS2.CWARN23.INFO

please imagine this:

[example]
there are a co.cc extension (in your mind).
please type on the address bar: http://co.cc
If .co.cc is an extension, where is the domain?

co.cc has a database of subdomains, and they are unique.

So, co is the domain, and the tld/extension is .cc
please refer to this link:
http://who.is/dns/co.cc/

I want to create like it

Thanks for that. So it is a free subdomain service.

Where he bought it?
and where can I check his whois neither in co.cc local whois?

I checked it on .co.cc's local whois:
http://www.co.cc/whois/whois.php


please imagine this:

[example]
there are a co.cc extension (in your mind).
please type on the address bar: http://co.cc
If .co.cc is an extension, where is the domain?

co.cc has a database of subdomains, and they are unique.

So, co is the domain, and the tld/extension is .cc
please refer to this link:
http://who.is/dns/co.cc/

I want to create like it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.