Welcome Guest, Not a member yet? Register   Sign In
403 in Controller Subdirectory access
#5

(06-24-2020, 05:53 AM)MatheusCastro Wrote: In this type of structure I usually use something like this:

Taking advantage of the default controller As Home and the default method index.

Code:
- Controllers
    - Admin
        - Admin (Change to Dashboard)
        - AdminControler
        - Login (Change to Home)
        - SecureThis

In routes:

PHP Code:
$routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function($routes)
{
    $routes->add('/''Home::index');
    $routes->add('/dashboard''Dashboard::index');
   { ... }
}); 

So your routes would look

Code:
http://mydevsite.vhost/admin/ - To login
http://mydevsite.vhost/admin/dashboard - To after login
http://mydevsite.vhost/admin/* - All after login

I think it becomes more readable. But, just a personal opinion.

Thank you for the opinion, but my problem persist, lets say I change the file name and class (already try many things tough):

Code:
- Controllers
    - Admin
        - AdminControler
        - Home
        - Login
 
the route as your suggestion is set to:
PHP Code:
$routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function($routes) {
    $routes->add('/''Admin/Login::index');
    $routes->add("home""Admin/Home::index");
}); 

the result is:
Code:
http://mydevsite.vhost/admin/ - 403 forbiden
http://mydevsite.vhost/admin/dashboard - working fine To after login

This 403 forbidden is my main problem, I have tried to set:
Redirecting Routes, change file and class name
both not working but if I change the folder name to something else it works, is the name "Admin" cannot be used?
Reply


Messages In This Thread
RE: 403 in Controller Subdirectory access - by inumaru - 06-24-2020, 09:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB