How to get current page URL in php

Our Current url is

echo $url;

Output :

REQUEST_URI  return only  root website folder instead of returning full page.
if you want actual link then use this syntax

$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $actual_link ;

Output :

In the above code $_SERVER[‘HTTP_HOST’] return the  domain name through which the current request is being fulfilled.

Anuj Kumar

This is Anuj Kumar. I’m a professional web developer with 4+ year experience. I write blogs in my free time. I love to learn new technologies and share with others.
I founded PHPGurukul in September 2015. The main aim of this website to provide PHP, Jquery, MySQL, PHP Oops and other web development tutorials.

Recommended Tutorials for you


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.