Objective

How to get current URI in Joomla PHP pages.

Current URI:

echo 'Current URI: ' . JURI::current();
echo 'Joomla root URI: ' . JURI::root();
echo 'Joomla base URI: ' . JURI::base();

JURI::root() and JURI::base() will return the same results in front end. In backend, JURI::base() will add /administrator/.

Results:

Current URI: http://www.makeyourjoomla.com/directory1/directory2/index.php
Joomla root URI: http://www.makeyourjoomla.com/
Joomla base URI: http://www.makeyourjoomla.com/ OR http://www.makeyourjoomla.com/administrator/


Sources:

 

Keep Me Informed

Keep me informed of the latest extensions releases and offers. One email maximum per month.

Offer Me A Coffee!

If you like my work, offer me a coffee! Nick.