createUrl on subdomain


I have following UrlRules:

  'rules' => array(

                'http://<nick:\w+>' => 'users/showuser',

                'photo/<pid:\d+>/<title:.+>' => 'photo/view',

Now, I’m trying to access url => action ‘users/showuser’ works fine.

But! All links generated by createUrl will have subdomain ‘nick.’.



How to avoid it?

I need, that all my links point to my primary domain, not including subdomains.

Well, your links will have nick. in front of the domain name if you are looking at them from, but if you are looking at them from they look just fine, right ?

Try to set the base url manually in your config file to your domain name, something like:

'baseUrl' => '',

Also, maybe you need to slightly alter your rules, like:

'http://<nick:[^www]\w+>' => 'users/showuser',

to be able to still use .

And move the subdomain rule at the bottom of your rules list.

Also, try createAbsoluteUrl() too and see the behavior of that method in comparison with createUrl()

Dunno if this is going to fix your issue, but worth a try.