删除网址yii2中的问号?

时间:2017-08-28 08:44:50

标签: yii2

如何删除?在url yii2?

规则中的

'rules' => [
        '<alias:\w+>' => 'site/<alias>',
    ],

在.htaccess中

RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

1 个答案:

答案 0 :(得分:1)

尝试这套规则:

'<alias:\w+>/<id:\d+>' => 'site/<alias>',
'<alias:\w+>' => 'site/<alias>',