Skip to content

021fneves/base-url-dynamic-ci4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Dynamic Base URL on Codeigniter 4

If you need make base_ur() dynamic every project with Codeigniter 4, you can config by using this code. You need config on 2 files: App.php and Constants.php.

On App.php change $baseUrl value with $baseURL = BASE;

On Constants.php add new line with code bellow:

$base = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']) : 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']);

defined('BASE') || define('BASE', $base);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages