Category Archives: Finding Current URL in PHP

How to find the Current URL in PHP

For Introduction Click Me
How to find the current Domain in PHP?

If you need the current domain of the site/url .Here is the sample code

// Using HTTP_HOST

$domain_name = $_SERVER['HTTP_HOST'];
echo $domain_name;

if the current url structure is: Remember http://www. part is excluded. The output will be
If you need to make the link please concatenate the http://www. part with the output