yii2中的用户友好URL无法正常工作

时间:2017-01-01 18:43:39

标签: url yii2

yii2中的用户友好网址无效。我无法弄清楚为什么....这是我的项目代码

网上商店/ htaccess的

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
AddDefaultCharset utf-8

RewriteCond %{REQUEST_URL} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
RewriteRule ^css/(.*)$ /web/css/$1 [L]
RewriteRule ^fonts/(.*)$ /web/fonts/$1 [L]
RewriteRule ^js/(.*)$ /web/js/$1 [L]
RewriteRule ^images/(.*)$ /web/images/$1 [L]
RewriteRule (.*)$ /web/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php

网上商店/网络/ htaccess的

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

网上商店/配置/网络

....
            'urlManager' => [
                'enablePrettyUrl' => true,
                'showScriptName' => false,
                'rules' => [
                    'category/<id:\d+>/page/<page:\d+>' => 'category/view',
                    'category/<id:\d+>' => 'category/view',
                    'product/<id:\d+>' => 'product/view',
                    'search' => 'category/search',
                ],
            ],
    ...

它没有用户友好的网址http://yii2.loc/eshop/web/index.php?r=category%2Fview&id=4,但是当我使用用户友好的网址时,网址会变成这样http://yii2.loc/eshop/web/category/4,但它不起作用。我刚刚找到了对象!请帮助我

0 个答案:

没有答案