Skip to content

Codeigniter 4 not redirecting well. is not including the baseUrl well on redirect #2342

Closed
@ChibuezeAgwuDennis

Description

@ChibuezeAgwuDennis

Hello My Pros,
How are you today please I am having issue to redirect to page.

I customise my app/Config/App.php by adding constructor to it where I auto set the base url like this

public function __construct()
{
$root = (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS']) ? "https://" : "http://") . $_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);

$this->baseURL = $root;
}

I want to redirect to localhost/aensd/login
Where aensd is the folder where my application is stored
And It redirect to localhost/login instead of localhost/aensd/login calling error 404

if ($users->save($user))
{
// Success!

return redirect()->route('login')->with('message', lang('Auth.registerSuccess'));
}

I hope this is bug on the redirect path of the script. please check if there is anything you can do on this I have try to find away to solve this issue but no way then planing to code my own class which will override this.
but still need the follow come redirect so that my code will not be bulky
please help me on this

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions