Problems with URL-manager



  • I wrote the rules like that.

    'urlManager'=>[
            'showScriptName' => false,
            'enablePrettyUrl' => true,
            'rules' => [
                '/admin'=>'/tree/admin',
            ],
    

    I'm trying to go to the address. http://localhost/admin - It works, http://localhost/admin/- No! I've been stumbling on such an article. It's okay, but still, can you save the situation?



  • Probate the use of regular expression and specific label ? the number of repetitions of zero or one.

    urlManager'=>[ 
        'showScriptName' => false, 
        'enablePrettyUrl' => true, 
        'rules' => [ 
            '<action:(admin)\/?>' => 'tree/<action>',
        ],
    

    In the rules (rules) of the manager (urlmanager) of the Fremvork, a regular expression is used if it is written in the current form <TAG_NAME:REGULAR_EXPRESSION>♪ where

    TAG_NAME - The name of the current

    REGULAR_EXPRESSION - Regular expression

    Details can be read https://github.com/yiisoft/yii2/blob/master/docs/guide-ru/runtime-routing.md




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2