Parameterized host names

I know that post on this topic have already been posted and answered in this forum, but they were not sufficient for me to understand how to make www.mysite.com look like www.username.mysite.com.

I just can’t figure out how parameterized host names work.

As I understand, this rule

array(

'http://<user:\w+>.example.com/<lang:\w+>/profile' => 'user/profile',

)

is used with subdomain: http://admin.example.com/ and parses <user> into GET parameters.

But in my situation I want to imitate a subdomain.

My rule is:

‘http://<username:\w+>.mysite.com/profile/<user_id>/showcase’=>‘showcase/view/user_id/’

and the browser says it can’t find url http://www.username.mysite.com/profile/65/showcase

‘showcase/view/user_id’ points to “Showcase module View controller User_id action” which probably doesn’t exist. Try ‘showcase/view’ instead.

Btw, why do you need both username and user_id in the same rule? Username would be enough to identify user uniquely.

Szia! :slight_smile:

There are many of us working on this project… user_id is also represented in rules as id …

it look like the browser tries to find a real url www.username.mysite.com which does not exist.

If you want the www part, then you have to define it. In fact www is a subdomain, so you would have 2 subdomains with this rule:


'http://www.<username:\w+>.mysite.com/profile/<user_id>/showcase'=>'showcase/view/user_id/'

no, I do not need www

now the browser reports that it can’t find username.mysite.com and drops profile/65/showcase

I can’t understand what’s wrong?

I’m I moving in the wrong direction?

I’ve googled that some use a DNS wildcard (*.website.com)to enable subdomain usage. Is it necessary to achieve my goal?

Yes it’s necessary. Otherwise you would have to set a DNS entry for each username.