CakePHP 3:路由器错误,htaccess自动重定向webroot / admin /

时间:2016-01-11 16:23:59

标签: php .htaccess admin cakephp-3.0

当我输入localhost:3000/admin时 网址重定向到localhost:3000/webroot/admin 并显示错误WebrootController未找到

但我输入localhost:3000/admin/是正确的 路由器

Router::prefix('admin', function ($routes) {
    //$routes->connect('/:controller/:action/*', ['prefix' => 'admin']);
    $routes->connect('/', ['controller' => 'admins', 'action' => 'index']);
    $routes->fallbacks('InflectedRoute');
});

htacess:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$ webroot/    [L]
    RewriteRule    (.*) webroot/$1 [L]

我的项目

enter image description here

1 个答案:

答案 0 :(得分:0)

在webroot中删除或更改文件夹名称admin

它可能是一个cakephp bug。