By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,028 Members | 810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,028 IT Pros & Developers. It's quick & easy.

Subdomain, customized home page

P: n/a
I have a question about subdomains. I would like my website to have
subdomains that essentially show my regular main website, except that
the subdomain passes as a variable on all pages so that I can use the
subdomain as a variable to customize details. For example, the home
page at www.thesite.com would have a set of information displayed, but
the subdomain (subdomain.thesite.com) would display certain additional
details.

Am I approaching this correctly? Anyone know the best solution?

(I am currently parsing the url and grabbing the subdomain that way,
but it seems a little...I don't know, iffy.)

Thanks.
Jul 23 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
..oO(Josh)
>I have a question about subdomains. I would like my website to have
subdomains that essentially show my regular main website, except that
the subdomain passes as a variable on all pages so that I can use the
subdomain as a variable to customize details. For example, the home
page at www.thesite.com would have a set of information displayed, but
the subdomain (subdomain.thesite.com) would display certain additional
details.
When posting example URLs, please don't use existing domains, but
example.com/org instead. They're reserved for that purpose.
>Am I approaching this correctly? Anyone know the best solution?
Have a look at mod_rewrite. You can use it for internal rewrites like

http://foo.example.com/ =http://example.com/?subdomain=foo

Your script can then easily grab the used subdomain from the $_GET
array.
>(I am currently parsing the url and grabbing the subdomain that way,
but it seems a little...I don't know, iffy.)
At some point you have to parse it. Either in the .htaccess with
mod_rewrite or in your script. It isn't much of a difference.

Micha
Jul 24 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.