Welcome Guest, Not a member yet? Register   Sign In
How to auto base_url in codeigniter 4.3
#1

i test multi domain in codeigniter 4.3 but dont work, can someone show me.

PHP Code:
public string $baseURL 'http://localhost:8080/ciall/ci4/ci43/public/';
public array 
$allowedHostnames = ['http://123.1.1.3:8080/ciall/ci4/ci43/public/']; 

in home.php controller  i echo base_url() it default
Code:
base_url= http://localhost:8080/ciall/ci4/ci43/public/

1. i want if i write localhost:8080  base_url echo http://localhost:8080/ciall/ci4/ci43/public/
2. if i write http://123.1.1.3:8080/ciall/ci4/ci43/public base_url() echo http://123.1.1.3:8080/ciall/ci4/ci43/

thank your for reading
Reply
#2

Try
PHP Code:
public array $allowedHostnames = ['123.1.1.3:8080']; 
Reply
#3

(This post was last modified: 01-10-2023, 12:22 AM by startup.)

PHP Code:
public array $allowedHostnames = ['123.1.1.3:8080']; 

don't work
Reply
#4

Sorry, I misused.

PHP Code:
public array $allowedHostnames = ['123.1.1.3']; 
Reply
#5

thank you kenjjs, public array $allowedHostnames = ['123.1.1.3']; working
Reply




Theme © iAndrew 2016 - Forum software by © MyBB