Url::to and pretty urls in advanced

Hi,

I have problem with pretty URls. I set server as it was mentioned in the installation guide. In basic when I use rule

e.g:


'megasite'=> 'site/showsupersite'

and have


Html::a('somelink', Url::to(['megasite']))

,

and type in browser extrasite.com/megasite Urlmanager redirects me to showsupersite. This is ok.

But in advanced it only works when I put in link exact name of action:


Html::a('somelink', Url::to(['showsupersite']))

. I’d like use this same way as in basic. What I missed?

Change Url:: to Url::to

Sorry I missed this when I was writing post. In code I have


Url::to

:rolleyes:

Try:


Html::a('somelink', ['site/showsupersite'])

Where did you configure the route/rule and where are you trying to use it? Both in frontend?

Ok, I got it.

But probably (in comparison with my earlier adventures with basic) it’s weird.

I have rules:


'rules' => [

                '/' => 'site/index',

                'artykul/<idArticle>' => 'site/article',

                'artykuly' => 'site/allarticles'

            ],

and when I want to have in browser site.com/artykul/27 or site.com/artykuly I have to set


Url::to(['article', 'idArticle' => $id])

or


Url::to(['allarticles'])

. In my basic apps I pointed what was on the left side


Url::to(['artykuly'])

in order to trigger site/allarticles. Now I point action to get pretty path in browser.

I use virtual hosts with configuration from installation guide.