rashidul — 2012-09-07T05:29:18-04:00 — #1
Site scenario: user register/sign up my site then a subdomain will automatically be created based on their username [for example username.example.com]. How can I make this automatically when user sign-up? I like to use only one instance of files of my site but many subdomains. Then how can I display user specific data..May be I can extract the first portion and get the username and fetch the data based on username..
How can i achieve this: files only in one directory but many subdomains created automatically and utilize the same files?
FYI I checked the post at http://www.sitepoint.com/forums/showthread.php?806237-Create-sub-domains&highlight=subdomain
but still not clear.
rashidul — 2012-09-10T16:55:44-04:00 — #2
Anyone there be able to help on this issue?
jaswinder_rana — 2012-09-12T14:59:52-04:00 — #3
From what I know (and maybe wrong), its 2 part process. Main part is that you need to somehow configure your webserver to "listen" to this new domain. There are 2 ways:
- Enable wildcard domain for your site (*.site.com). This will make sure that any domain is redirected to the same site (so you can have xxx.site.com) and from there you figure out the subdomain using apache and get username.
- You add a line to httpd.conf to create a new vhost for every user. Coding aspects is still the same as first option.
The question now, I guess, is whether you know Apache or not? (assuming you have apache as your webserver).
rashidul — 2012-09-12T15:15:50-04:00 — #4
Thanks for ur response. I appreciate it.
I already get the answer, sorry unable to notify