How to get the current URL in Codeigniter

In this tutorial you will learn about the How to get the current URL in Codeigniter and its application with practical example.

In this How to get the current URL in Codeigniter tutorial I will show you how to get current url in codeigniter. In this tutorial you will learn to get current application url in codeigniter. In this article I will share example to get current url in codeigniter application.

get the current URL in Codeigniter

In this step by step tutorial I will demonstrate you with example how to get current url in codeigniter. Please follow the instruction given below –

Get current URL in codeigniter

In Codeigniter we have a builtin url helper library. In codeigniter url helper allow us to get the current URL using the current_url() method. Below is the example to get the current url using the current_url() method in codeigniter.

Example:-

how to get URL segment in codeigniter

In codeigniter the segment() method is used to get the url segments from the url. Below is the example to retrieve the url segments using the segment() method in codeigniter.

Example:-

Get Current Controller Method Name in codeigniter

In codeigniter the fetch_method() method is used to get the current controller method’s name . Below is the example to get the current controller method name using the fetch_method() method.

Example:-

In this tutorial we have learn about the How to get the current URL in Codeigniter and its application with practical example. I hope you will like this tutorial.