How to Get Current URL with Query String in Codeigniter?

By Hardik Savani November 5, 2023 Category : Codeigniter

If you require to get current URL with parameters in your codeigniter project then you can get easily using "url" helper. Codeigniter provide url helper library that way we can get existing page url or base url etc. you can also get only parameters without URL using "input" as like bellow.

$parameters = $this->input->get();

But, we are getting full path using "url" helper and $_SERVER variable. So, you can see how to get full path using both as bellow:



$currentURL = current_url();

$params = $_SERVER['QUERY_STRING'];

$fullURL = $currentURL . '?' . $params;


I hope it can help you...