however what i want to do is that a visitor can type in chickenboy.user.com and the visitor will automatically see the profile.
any idea how i can do this? without a redirection. I mean one of the way to solve this problem is to have the index php file at user.com to read the database and redirect to the example.com url. But i dont want to do that, i just want to have chickenboy.user.com to show the profile and thats the end of the story.
So far the setup is that
So can you tell me how may i go with this.
The only solution that i know of currently is to have a user.com point to /var/www/example/, then at example/index.php check the hostname and forward as convenient - but this definitely isnt best practice…
Then in your UserController in the actionView method you should check whether $_GET[‘subdomain’] is set. If so, load the User model using this instead of $_GET[‘id’].
You’re going to need to refine the URL route to ignore any other existing subdomains you are using (eg. www). And you’ll need wildcard domains set up on your server (unless you’re creating them individually).