I'm creating a website using MVC framework (Yii) and I need to dynamically create subdomains, i.e. http://company.website.com
So, in order to achieve this I've added a DNS wildcard (*.website.com). Now the problem is that my application controllers are all the same for www.website.com and for company.website.com. For example, I have a User
controller with Register
action (user/register
). Now if I go to www.website.com/user/register I can register, but I can do exactly the same if I go to company.website.com/user/register. And this behaviour is the same for all my controllers.
I realize everything is working correctly, but how do I separate controllers for www.website.com and for compnay.website.com? I don't want users to access register/login/other controllers and actions from the subdomian url.
Any suggestions are greatly appreciated!
Thank you!