Get the full URL in PHP

Today, We want to share with you Get the full URL in PHP.In this post we will show you php get full url with parameters, hear for php get current url with query string we will give you demo and example for implement.In this post, we will learn about php get current url without query string with an example.

Get the full URL

There are the Following The simple About Fetch the full URL Full Information With Example and source code.

As I will cover this Post with live Working example to develop php get current url path, so the php get full url with hash for this example is following below.

$actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";

both HTTP and HTTPS, you can use

$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";

<h3>GET current page full URL in php</h3>
echo $url;

How to get URL of current page in PHP



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

Get current URL path in PHP


List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

 $relative_path = $_SERVER['PHP_SELF'];
 $complete_path = __FILE__;
 $complete_path = $_SERVER['REQUEST_URI'];

PHP $_SERVER Superglobal Variable

How to get current page URL in PHP

Another must read:  PHP download file from URL Curl

echo $uri; 
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
echo $url; 
$query = $_SERVER['QUERY_STRING'];
echo $query;

PHP: How to Get the Current Page URL

function curPageURL() {
 $liveURI = 'http';
 if ($_SERVER["HTTPS"] == "on") {$liveURI .= "s";}
 $liveURI .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
 } else {
 return $liveURI;

  echo curPageURL();

function curPageName() {
 return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);

echo "The current page name is ".curPageName();

Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Simple Fetch full URL Server Side.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

Your email address will not be published. Required fields are marked *