Joomla JURI examples

I usually need to use methods of Joomla’s JURI class. And I always switch JURI::base() with JURI::root() and I always have the problem how to get current URL. So I wrote this post to make clear which method does what. I hope I save time to myself in the future, maybe someone else ass well. And maybe, I finally memorize it but I don’t give much hope to this one. I explain it at this website URL to make it clear.


JURI::base() returns string ‘’ at frontend and ‘’ at backend.

JURI::base(true) returns empty string ” at frontend and string ‘/administrator’ at backend.




This is the right answer to often asked question “how to get the domain?”.

JURI::root() returns string ‘’ at frontend and ‘’ at backend as well.




This is tricky method. At documentation is written “returns the current request URI without the query or fragment parts”. Example:

If you are at

JURI::current() returns string ‘’

If you are at

JURI::current() returns string ‘’.

If you want to get the real current URL……with the query and fragment, use this:


that returns string ‘’ for the example above.


Share this :

Comments are closed.

Related post

Free Responsive Website templates

ThemeVina is Best site for free sharing and download Wordpress themes, Joomla templates, Responsive website templates and more HTML templates.

All template in Site are free. You can download and install for your site.

Contact us

  • Brand: Theme Vina
  • Email:
  • Website:
  • Address: 367 Tran Hung Dao Street
  • Location: Thai Binh City, Thai Binh, Viet Nam