I have been searching all over the net for this and it has been doing my head in. I am creating a community service for people to signup to, the problem I am encountering is I can't find the way in which i want each different community to be viewed even though I know it is possible. What I want to do is be able to grab the user from the start of the domain and use that to pull all the information: eg
http://user.domain.com
each different community will be displayed depending which user is selected and obviously an error will occur for non existing users. How would I go about grabbing the user and using the same code for each differnt user.domain.com.
Any help would be great, thanks.
Varible from a domain
Moderator: General Moderators
two ways:
- use mod_rewrite to rewrite the url to something like http://domain.com/script.php?user=user
- use $_SERVER['HTTP_HOST']
Would that actually redirect the user to the URL or would the real URL be masked? I know this website uses the way in which i want:Weirdan wrote:two ways:
- use mod_rewrite to rewrite the url to something like http://domain.com/script.php?user=user
- use $_SERVER['HTTP_HOST']
http://ag2.avidgamers.com/
and then when i made an account i was given the URL:
http://test.avidgamers.com/
and that is the URL which is actually shown in the URL bar while browsing the whole site.
would the method you posted above allow me to do this?