How to get the current page url in Joomla

In Joomla, there is a fast way of getting the page url by using the Joomla API:

$pageURL = JURI::base(); 
echo $pageURL;

This will get the base url. For example, if the full url is, JURI::base() will fetch

If you need the current absolute path url you must use this:

$uri = & JFactory::getURI(); 
$pageURL = $uri->toString(); 
echo $pageURL;

Subscribe to our Blog
Subscribe to this content and receive updates directly in your inbox.

This website uses cookies so that we can provide you with the best user experience. By clicking "continue" you agree to cookies being used in accordance with our Cookies Policy.