Welcome Guest, Not a member yet? Register   Sign In
Whenever I am redirecting to a specific link "index.php" appears in the URL
#1

(This post was last modified: 10-09-2023, 12:54 AM by shahzaibahmed52.)

Hi, 
I need some help in formatting URLs. whenever I am redirecting to a specific link "index.php" ("http://localhost/index.php/login") appears in the URL and as a  result, my CSS does not load. Below are the routes that I have created and the filter that redirects the users to the login link.
Code:
//// Routes ////
$routes->get('/', 'AdminPanel::index', ['filter' => 'authGuard']);
$routes->get('login', 'Login::index');
$routes->post('loginvalidate', 'Login::validateLogin');
$routes->get('logout', 'Login::logout');

//// Filter ////
<?php
namespace App\Filters;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Filters\FilterInterface;

class AuthGuard implements FilterInterface
{
    public function before(RequestInterface $request, $arguments = null)
    {
        if (!session()->get('isLoggedIn'))
        {
            return redirect()
                ->to('/login');
        }
    }
   
    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
    {
       
    }
}
Reply
#2

See https://codeigniter4.github.io/CodeIgnit...figuration
Reply
#3

(10-09-2023, 01:00 AM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgnit...figuration

Thanks Brother
Reply




Theme © iAndrew 2016 - Forum software by © MyBB