Yii Framework Forum: Problem with UrlManager mapping domain to module - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem with UrlManager mapping domain to module Rate Topic: -----

#1 User is offline   Timbo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 19-January 10

Posted 03 September 2010 - 02:46 PM

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 array('/sales/default/page','view'=>'specials') creates the url
h..p://www.salesdomain.com/index.php/default/page/view/specials, 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: Unable to resolve the request "default/page/view/specials".

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!
0

#2 User is offline   Timbo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 19-January 10

Posted 06 September 2010 - 03:14 AM

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 'http://www.salesdomain.com/' is parsed to '/sales' (correct)
The request 'http://www.salesdomain.com/index.php' is parsed to '/sales' (correct)
The request 'http://www.salesdomain.com/index.php/default' is parsed to '/default' (incorrect - should be '/sales/default')
The request 'http://www.salesdomain.com/index.php/default/page/view/specials' is parsed to '/default/page/view/specials' (incorrect - should be "'/sales/default/page' array('view'=>'specials')"

I'd be very grateful for any help.
0

#3 User is offline   MiksIr 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 01-September 10
  • Location:Russia, Moscow

Posted 06 September 2010 - 07:26 AM

Try to set rules without index.php
Btw

Quote

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

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users