如何删除?在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
答案 0 :(得分:1)
尝试这套规则:
'<alias:\w+>/<id:\d+>' => 'site/<alias>',
'<alias:\w+>' => 'site/<alias>',