Change url structure


(mahmood) #1

Hi Yii2 team
I want to know that, is it possible that change the URL structure? for example:
My domain is : www.test.com
I want make a new module that each user has a exclusive domain and when it calls the URL would be like www.aaa.test.com
I mean the module call the username and set it on the URL before base URL
another example: username is David so my URL should be www.david.test.com

Thanks in advance
Please share your idea


(Alexander Makarov) #2

Yes. Sub-domains are supported by URL manager.

Personally, I’d not recommend that if that’s a single application because of navigation issues, cookies, search engine optimization etc.


(mahmood) #3

Thanks dear Alexander
Could you please tell me more and explain about these solution?


(Alexander Makarov) #4
"http(s)?://you-domain.net/some/path" => 'controller/action',

that’s how URL rule should look like.