Skip to content

base_url() value dropped between namespaces #1942

Description

Creating modules, but when returning from a module, return->response->to (base_url('/')) fails because base_url() in other namespace is blank.

Sample code:
App/Config/App.php: public $baseURL = 'http://localhost/ci4/';

Route: $routes->add( '/', 'App/Controllers/Home::index');

App/Controllers/Home.php:
if (!$security['logged_in']) $this->response->redirect(base_url('login'));

Auth/Controllers/Login.php:
// Login form is processed and all is good. Return to Home now.
$this->response->redirect(base_url("/")); ===> goes to 'http://localhost/' = not routed
$this->response->redirect(site_url("/")); ===> goes to 'http://localhost/ci4/' = worked

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