Controller And Module With Same Name

I have controller and module with same name: download


'urlManager'=>array(

    'urlFormat'=>'path',

    'showScriptName'=>false,

    'rules'=>array(

        'http://'.SITE_DOMAIN.'/<action:(download)>/<url:.*>'=>'<action>',

        'http://<module:(download)>.'.SITE_DOMAIN.'/<code:\w{32}>'=>'<module>',

    ),

)

So I want to links like: http://domain.com/download/dir1/dir2/file1.zip

to be routed to: application/controllers/DownloadController

where $_GET[‘url’]==‘dir1/dir2/file1.zip’

And links like: http://download.site.com/some_code

to be routed to: application/modules/download/controllers/DefaultController.php

where $_GET[‘code’]==‘some_code’

But now both types of links are routed to: application/modules/download/controllers/DefaultController.php

I can’t understand why

Is it real to use full absolite URL with ‘http://’ prefix in ‘rules’? I think it is not.

Hi,

in order to process host in your rules, you should set CUrlRule::hasHostInfo to TRUE:




'rules'=>array(

	'http://'.SITE_DOMAIN.'/<action:(download)>/<url:.*>' => array('download/<action>', 'hasHostInfo'=>true),

	'http://<module:(download)>.'.SITE_DOMAIN.'/<code:\w{32}>' => array('<module>', 'hasHostInfo'=>true),

),



In some caseses I have different rules for http and for https.

Nothing changed :(

I think it is not possible to use domain names in ‘rules’ of ‘urlManager’ component. I think it must be implemented via htaccess.