Hello people!,
I’m making a site which uses dynamic subdomains, the URLs are something like this : subdomain.domain.com, the issue I have is that when you type in a wrong subdoman, (lets say that the subdomain “dish” doesn’t exist) " dish.domain.com " I get a 404 URL as expected the problem here is the menu (I’m using CMenu) and it creates the items acording to the subdomain,with the above example i get menu items with " dish.domain.com/<controller>/<action>" which lead to a 404 page as well in a vicious cicle. I’d like to ask for your help, if there s something that I could do like if there is a 404 error display the menu with a base url of " domain.com " or something like that. I’m using CMenu like the example below.
<?php $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=>'Foo', 'url'=>array('<controller>/<action>')),
array('label'=>'Foo', 'url'=>array('/<controller>/<action>')),
array('label'=>'Foo', 'url'=>array('/<controller>/<action>')),
array('label'=>'Foo', 'url'=>array('<controller>/<action>', 'view'=>'<view>')),
array('label'=>'Foo', 'url'=>array('<controller>/<action>')),
),
)); ?>
If something, I have created rules in the main config that follow this pattern:
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<id:\w+>.domain.com/' => 'site/index',
Thanks in advance!
Edited:
I solved this problem in a very ugly way I believe, what I did was to create a menu with predefined absolute URLs which only appears when the error triggers. If by any chance someone has a better solution let me know! I’ll be glad.
Cheers!