I will explain to you how to get the current URL in Codeigniter. Sometimes, we need to get the current URL path in your controller file or view file. 

current_url() through we can get the current URL in your Codeigniter application. But Before to get we should load the "URL" helper to autoload.php or controller

Step 1: Load Url Helper Class in controller 


then call the fuction current_url in your controller file, look at the following example



class TestCtrl extends CI_Controller {

    public function __construct() {

    public function index(){
        //this will return current page url
        echo current_url();