Welcome Guest, Not a member yet? Register   Sign In
How to set dynamic base_url in codeigniter 4.2.2
#1

(This post was last modified: 08-15-2022, 11:50 PM by startup.)

i have one url below in app.php
PHP Code:
public $baseURL 'http://localhost:8080/ciall/ci4/ci422/'

i want  base_url dynamic below

PHP Code:
public $baseURL '://'.SEVER['HTTP_HOST'].'/ciall/ci4/ci422/'
Reply
#2

This is a little bit old but should still work.

Setting Dynamic base URL in CodeIgniter
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Make sure to validate SEVER['HTTP_HOST'], otherwise you would create a vulnerability.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB