CodeIgniter Forums

Full Version: Auto redirect to root folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I connect on below link, website will auto redirect to new url:

redirect to http://localhost:8888/admin

redirect to http://localhost:8888/admin

redirect to http://localhost:8888/admin/auth

But when I connect to "http://localhost:8888/ci4/public/admin.html", and routes realized that i connect to V_admin Controllers, and website has print contents of admin page.
I think the issue here is when i connect a folders not exists, website will auto redirect to root folder. On my source code, I set V_admin for admin controllers.
My Routes:

$routes->group('/admin', function($routes)
    //    Authentication
    $routes->add('auth.html', 'VAdmin\Controllers\Auth::index');
    $routes->add('auth/(:alpha).html', 'VAdmin\Controllers\Auth::index/$1');
    $routes->add('blog',  'Admin\Blog::index');
$routes->add('/admin', 'VAdmin\V_admin::index');

I don't know how to fix it or find any problems with my localhost. I used MAMP Pro on Mac Sierra. And CI3 run very well.
I asked on Github but I closed it after i read rules, so I post here, please help.
Try renaming the admin.html to admin.php
I just found a way that can say "temporary fixed"

On .htaccess, Redirect Trailing Slashes:

I turn from 

RewriteBase /ci4/public/

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]


RewriteBase /ci4/public/

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /ci4/public/$1 [L,R=301]

Then I move folders name "admin" form 'ci4/public/admin' (used for assets file)
to folders "ci4/public/assets/admin"

Then the problems has resolved. But I think this is not a best solution.

I wonder on .htaccess that I have RewriteBase is /ci4/public/, why redirect trailing slashes not redirect to this Base?