How to get current page URL in php

3

- Advertisement -

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.

- Advertisement -

Leave A Reply

Your email address will not be published.

3 Comments
  1. Shamim Akhtar Sheikh says

    Sir, How to get SEO friendly url using php?

  2. Yogesh singh says

    Nice article, code is working for my website.
    Thanks

Leave A Reply

Your email address will not be published.