1

I am not able to get the yii parameterized hostnames working. I am trying to display http://member.testsite.com when the user clicks on login from http://www.testsite.com.

I have the member module created with SiteController.

In my rules, I have:

'rules' => array(
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                'http://member.testsite.com' => 'member/site/index',
            ),

In my login, I have the URL pointing to

'url'=>array('member/site/index')

When I hover over login, it shows member.testsite.com, but when I click it takes me to website-unavailable.com

When I change the rules to

'http://member.testsite.com' => 'member/<controller>/<action>',

it takes me to testsite.com/member/site/index/

Am I missing any step?

skris
  • 17
  • 2
  • 5

1 Answers1

0

Example:

'rules' => array(
    '://<member:\w+>.<host>/<controller:\w+>/<action:\w+>'
        => '<controller>/<action>',
),
Valery Viktorovsky
  • 6,487
  • 3
  • 39
  • 47
  • Thanks @Valery for the response. The URL still resolves to testsite.com/member/site/index and not member.testsite.com/site/index. Do I have to add member.testsite.com to apache conf? – skris Jun 01 '13 at 15:57
  • Of course, you should configure wildcard domain and web server. http://stackoverflow.com/questions/758351/virtualhost-for-wildcard-subdomain-and-static-subdomain – Valery Viktorovsky Jun 01 '13 at 17:10
  • what would be the document root in such cases? I have the document root as `DocumentRoot /var/www/testsite/frontend/www` for testsite.com. Should I keep the same for the member.testsite.com? – skris Jun 02 '13 at 00:25
  • @skris yes, /var/www/testsite/frontend/www – Valery Viktorovsky Jun 02 '13 at 06:28