Reputation: 610
I am trying to create subdomains for users as each has their own "website". (user.domain.com) This is all "virtual" as all the files, controllers, folders, etc are the same. Everything is dynamically created. I think I've got all the DNS, mod_rewrite, htaccess, etc stuff down, but I've got another problem.
The problem is when a guest (non-user) visits a user's website (user.domain.com). An example to illustrate this:
So the question is, How do I keep track of which subdomain the guest is on? Since the client is a guest and not a logged in user, I can't look at the logged in user's information.
I am just interested in ideas of what the best implementation would be. Should I keep some variable in the session and keep checking that on each page? Should I pass a POST/GET variable with each link and then have the controller read that?
Upvotes: 1
Views: 103
Reputation: 8074
$_SERVER['SERVER_NAME']
This will give you the domain, just keep it in the session.
Upvotes: 1