Get current URL path in PHP


I need to get the path from the URL of the current request. For example, if the current URL is:


I would want this:


This question is tagged with php url

~ Asked on 2013-04-24 17:45:36

The Best Answer is


You want $_SERVER['REQUEST_URI']. From the docs:


The URI which was given in order to access this page; for instance, '/index.html'.

~ Answered on 2013-04-24 17:47:08


it should be :


Take a look at : Get the full URL in PHP

~ Answered on 2013-04-24 17:48:43

Most Viewed Questions: