Yii Framework Forum: Preety url is not working for me - Yii Framework Forum

Jump to content

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

Preety url is not working for me what should i fix?

#1 User is offline   mozaika 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-October 17

Posted 14 November 2017 - 01:58 PM

Hello

my web congiguration for url is

'urlManager' => [
            'class' => 'yii\web\UrlManager',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                '<alias:\w+>' => 'site/<alias>',
            ],
        ],


but the url still looks messed up :

http://localhost/yii2/YES-%E2%80%8F%E2%80%8Fbasic-rbac-school/student/view?id=3



or

http://localhost/yii2/YES-%E2%80%8F%E2%80%8Fbasic-rbac-school/student/index



what am i doing wrong here?
0

#2 User is offline   umneeq 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 137
  • Joined: 10-October 11
  • Location:Russia

Posted 14 November 2017 - 03:09 PM

What urls you want see?
0

#3 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,368
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 15 November 2017 - 04:04 AM

the reason your url's are messed up, is because your regex does does not match your routes

// the following route will only match words without any spaces or dashes 
'<alias:\w+>' => 'site/<alias>',

// try changing this to something like 
'<alias:[\w-]+>' => 'site/<alias>',

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