How To Get Current URL In Codeigniter?


In this article, we will explain to you how to get the current URL in Codeigniter. we can easily get the current Url using the helper URL.

We how to get current URL path in your controller file or view file. So, You can get simply using "URL" helper. Codeigniter provides URL helper library that way you can get existing page URL or base URL etc.

I can get current URL in your Codeigniter application. But, you can should load "URL" helper before use current_url(). you can load URL helper as bellow:

$this->load->helper('url');

In bellow example, you can see code how can i get current url in your controller file and view file.

$this->load->helper('url');

$currentURL = current_url();
print_r($currentURL);

I hope it can help you...

Leave a Reply

Your privacy will not be published. Required fields are marked *

We'll share your Website Only Trusted.!!