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 http://www.yoursite.com/index.php?option=com_content&view=article&id=1&Itemid=9, JURI::base() will fetch http://www.yoursite.com.

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


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

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.

Search