How to get current page URL in PHP

August 1, 2019

In This Tutorial, We are Learning How to get Current Page URL in PHP.


$_SERVER is the Superglobal Variable in PHP. $_SERVER is an Array Containing Information such as Headers, Paths and Script Locations. You can get current page URL in PHP.

The example below shows How to get current page URL in PHP

If You want Full Page URL. You have to Check the Protocol, Host and URL. First We Create the $protocol variable to check the value of Protocol. If site have SSL Certificate then $protocol = ‘https’ else $protocol = ‘http’.

Concatenation the All Variable. You can get Complete URL.

For More Detail

Hope this Help

Leave a Reply

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