Search code examples
phpcakephpcakephp-3.0

Why when I go to localhost/my_app/admin I was redirected to localhost/my_app/webroot/admin ? Cakephp


I'm using Cakephp 3.8 and I have developed an admin access, but when I try to access to them by the url : localhost/admin my browser (chrome) redirects me systematically to localhost/my_app/webroot/admin

This problem doesn't appear when I put a slash at the end : localhost/my_app/admin/

Also, I tested on Edge and Firefox and there is no problem, I can access to localhost/admin (without the slash at the end)

The route.php :

    $routes->connect('/admin', ['controller' => 'Users', 'action' => 'login', 'prefix' => 'admin']);
    Router::prefix('admin', ['param' => 'value'], function ($routes) {
        $routes->connect('/:controller');
        $routes->connect('/:controller/:action');
        $routes->connect('/:controller/:action/**');
    });

Sorry for my bad english,

Thank you very much for you'r help.


Solution

  • After 2 years, I found the real solution : My problem is that I've a folder named "admin" in my webroot, just give another name to the folder and clear navigator cache and it solve the problem.