PHP Web Development

How to get current page URL in php

Our Current url is https://phpgurukul.com/how-to-get-current-page-url-in-php/

Output :
/how-to-get-current-page-url-in-php/

REQUEST_URI  return only  root website folder instead of returning full page.

if you want actual link then use this syntax

Output :
https://phpgurukul.com/how-to-get-current-page-url-in-php/

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

About the author

Anuj kumar

I'm Anuj kumar a 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 is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.

Leave a Comment

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new tutorial for free!