How to Get Current Page URL of Website

In this article, you will learn How to Get Current Page URL of Website.

Example:-

<?php
$url=$_SERVER['REQUEST_URI'];
echo $url;
?>

Output:-

/how-to-get-current-page-url-of-website

Get Full URL

Example:-

<?php
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $actual_link ;
?>

Output:-

https://huboftutorials.com/how-to-get-current-page-url-of-website

Leave a Comment