Problem with UrlManager mapping domain to module

I have three domains (1 main domain + 2 parked domains) pointing to the same server. The two parked domains should map to modules. I have tried a number of rules in urlManager to achieve this but without success.

The closest I have got so far (for one of the parked domains):




    'urlManager'=>array(

        'urlFormat'=>'path',

        'rules'=>array(

            'http://www.salesdomain.com/' => 'sales/',   // This works

            'http://www.salesdomain.com/index.php/<_c:\w+>' => 'sales/<_c>',

            'http://www.salesdomain.com/index.php/<_c:\w+>/<_a:\w+>/*' => 'sales/<_c>/<_a>',

            'http://salesdomain.com/' => 'sales/',

            'http://salesdomain.com/index.php/<_c:\w+>' => 'sales/<_c>',

            'http://salesdomain.com/index.php/<_c:\w+>/<_a:\w+>/*' => 'sales/<_c>/<_a>',

        ),

    ),



But although urlManager builds the url correctly, the parsing doesn’t work. For example:

The route [font=“Courier New”]array(’/sales/default/page’,‘view’=>‘specials’)[/font] creates the url

[font="Courier New"]h…p://www.salesdomain.com/index.php/default/page/view/specials[/font], which is correct. (h…p = http so that it would display here correctly and not as a link)

But this url link results in an error: [font="Courier New"]Unable to resolve the request "default/page/view/specials"[/font].

I can’t emulate this in my dev environment, so I can’t debug.

I would appreciate any help or suggestion - I’m tearing my hair out!

I’ll bump this with more info…

With these rules:




    'urlManager'=>array(

        'urlFormat'=>'path',

        'rules'=>array(

            'http://www.salesdomain.com/' => 'sales/',   // This works

            'http://www.salesdomain.com/index.php/<_c:\w+>' => 'sales/<_c>',

            'http://www.salesdomain.com/index.php/<_c:\w+>/<_a:\w+>/*' => 'sales/<_c>/<_a>',

            'http://salesdomain.com/' => 'sales/',

            'http://salesdomain.com/index.php/<_c:\w+>' => 'sales/<_c>',

            'http://salesdomain.com/index.php/<_c:\w+>/<_a:\w+>/*' => 'sales/<_c>/<_a>',

        ),

    ),



The request [font=“Courier New”]‘http://www.salesdomain.com/’[/font] is parsed to [font=“Courier New”]’/sales’[/font] (correct)

The request [font=“Courier New”]‘http://www.salesdomain.com/index.php’[/font] is parsed to [font=“Courier New”]’/sales’[/font] (correct)

The request [font=“Courier New”]‘http://www.salesdomain.com/index.php/default’ [/font]is parsed to [font=“Courier New”]’/default’[/font] (incorrect - should be [font=“Courier New”]’/sales/default’[/font])

The request [font=“Courier New”]‘http://www.salesdomain.com/index.php/default/page/view/specials’[/font] is parsed to [font=“Courier New”]’/default/page/view/specials’[/font] (incorrect - should be [font=“Courier New”]"’/sales/default/page’ array(‘view’=>‘specials’)"[/font]

I’d be very grateful for any help.

Try to set rules without index.php

Btw

You can easy emulate it - just add you domain to hosts file with ip of your dev server.