user63898
user63898

Reputation: 30895

how do i create personal sub domain programmatically with php

if I like to create per user sub domain , how technically do I do this ?
for example if user XXX is registered to my site and I what to associated him the sub domain http://xxx.mydomain.com/ or http://www.mydomain.com/xxx/
what is the procedure to make it ?

Upvotes: 1

Views: 2518

Answers (3)

Petah
Petah

Reputation: 46050

You need to setup a wildcard DNS record to catch all subdomains and send them to you web server.

Then you need to setup Apache to catch all named virtual hosts and send it to a directory.

In the directory you would set htaccess to send all requests to one script which would read the sub domain from the server variables and handle it accordingly.

Upvotes: 4

SSTwinrova
SSTwinrova

Reputation: 39

If you want mydomain.com/xxx, then that's just a folder. Some hosts will also take mydomain.com/xxx and automatically make xxx.mydomain.com point to it without needing any configuration on your part. Might want to check that this isn't already the case for you.

Upvotes: 0

else
else

Reputation: 3

How would you create the subdomain manually?

Good. Now automate it.

Upvotes: -3

Related Questions