Hot answers tagged

42 votes
Accepted

Get the current Joomla URL

UPDATE The answer to the main question is: JFactory::getUri() is deprecated, use JUri directly like this: <?php $uri = JUri::getInstance(); echo $uri->toString(); // or simpler: echo JUri::...
user avatar
  • 3,693
17 votes

How to remove the 'index.php' from URL's?

You can do that by enabling the SEF URLs and especially the parameter "Use URL rewriting" in the Joomla global configuration. Please note that this will generate an internal server error if you didn'...
user avatar
  • 5,527
15 votes
Accepted

How to deal with Duplicated Content / URLs in Joomla?

TOC of this answer: Content under same Item Id How Duplicate content is created / Dynamic Pages / URLs SEO perspective Dealing with Duplicate content in Joomla References and links ...
user avatar
  • 19.5k
14 votes
Accepted

How do I generate a SEF URL in a custom module instead of the real URL?

Use JRoute for this: rtrim(JUri::base(), '/') . JRoute::_(ContentHelperRoute::getArticleRoute( $article->id, $article->catid )) but you don't need JUri::base() if you don't want to link to a ...
user avatar
11 votes
Accepted

Remove Article ID from Joomla 3 url

Step 1 Edit “components/com_content/router.php“, then continue on step 2. (You’ll probably have to re-do this step every time you update Joomla.) Step 2 (There are two places need to do this ...
user avatar
  • 2,269
7 votes

Get the current Joomla URL

According to the Joomla tutorial, you can get the current URL by this function: JUri::current();
user avatar
6 votes
Accepted

Use Joomla redirect component to fix broken URLs

With the below .htaccess rule you can redirect all pages from a url with the pattern of: https://www.portal-gestao.com/whatever/whatever/9999-title-of-the-page to a new url of : https://www....
user avatar
  • 19.5k
5 votes

Remove Article ID from Joomla 3 url

For anyone that don't want to get dirty with editing Joomla code, we shall mention that 3rd party SEF extensions provide the ability to remove the ids from the SEF urls. There are plenty of SEF ...
user avatar
  • 19.5k
5 votes

Get the current Joomla URL

UPDATE: JUri is now also deprecated. The correct way now is as follows: $uri = \Joomla\CMS\Uri\Uri::getInstance(); echo $uri->toString(); (Edited to include an initial backslash - required if ...
user avatar
5 votes
Accepted

Why are Joomla url query strings commonly delimited with "&amp;" instead of "&"?

It is to do with with HTML/XHTML compatibility. Before HTML5 having unencoded ampersands in URLs and in some other contexts was invalid. From XHTML validator: Entity references start with an ...
user avatar
  • 8,222
4 votes

How do I generate a SEF URL in a custom module instead of the real URL?

There is a system plugin called System: SEF. When enabled, this plugin scans the final HTML output just before it is sent to the browser, and replaces any non-SEF links with their SEF counterparts by ...
user avatar
  • 1,022
4 votes
Accepted

Possible to make slug generation turn "&" to "and" for url? as extension/plugin/patch?

There is no easy way to override that. In the end it uses JFilterOutput::stringURLUnicodeSlug() or JFilterOutput::stringURLSafe() (depending on the global setting) to make the alias URL safe. Since &...
user avatar
  • 5,527
4 votes

How to remove the 'index.php' from URL's?

You could add this code to the top of Joomla's index.php: if(strcmp($_SERVER['REQUEST_URI'], '/index.php') == 0 && $_SERVER['QUERY_STRING'] == ''){ header("HTTP/1.1 301 Moved Permanently")...
user avatar
4 votes

How to remove the 'index.php' from URL's?

Changed htaccess.txt to .htaccess Site > Global Configuration : Use URL rewriting (Choose Yes) SEO Settings Search Engine Friendly URLs(Choose Yes)
user avatar
4 votes
Accepted

New menu changes article URL

No, this is how Joomla's sef system works. If you were to make a menu item to an article, that too would lose its item id from the url. I think your only option would either be to override the router ...
user avatar
  • 2,366
4 votes

How to remove en from my site urls?

There is no need to set non-friendly SEF URLs. I have a multilingual website too and I had your same problem. Do as following: Go to Plugins -> Language Filter and set Yes to: Remove the prefix ...
user avatar
  • 367
4 votes
Accepted

How can I change a SEF URL to display another template?

Instead of $_SERVER['REQUEST_URI'], you can rely on JUri::root() template parameter can not be added concatenating it with &. It has to be ? ... but it depends on the Url query. Thus, you need a ...
user avatar
  • 7,415
4 votes
Accepted

How can I use 'SEO and Link Tools' in 'Admin Tools' in my situation?

In AdminTools set "Enable Link Migration" to Yes and then enter the old host name ie. example.com (don't include http:// at the front) However this will not solve your problem. The fastest way is ...
user avatar
  • 320
4 votes
Accepted

Multilingual Joomla site with multiple domains

There is a nice free plugin Language Domains from Yireo, which allows you to switch the domain-name as soon as a specific language is selected. Each domain is bound to a language, by configuring ...
user avatar
  • 3,017
4 votes

Joomla turns all menu items to sub-sub-menu items when adding a new one

The issue was down to a problem with a PDO database file MySQL driver, which is why it wasn't replicated on my other 3.5.0 site, which was using MySql. There is a fix here, or it should be patched in ...
user avatar
  • 3,072
4 votes
Accepted

How do I turn off Joomla inserting a BASE tag into the HTML?

I found this answer, but I don't think it's permanent. https://forum.joomla.org/viewtopic.php?t=354052#p2725317 To remove the base tag in the header simply add this to your template file (index.php) $...
user avatar
  • 293
3 votes
Accepted

Is this a route loop?

We made this problem go away by updating Joomla to 2.5.24 (a painless point-release upgrade) and updating Document Seller to its 3.5 version, and the problem described above resolved itself exactly as ...
user avatar
  • 151
3 votes
Accepted

The URL loaded two times on every page

This issue is caused by blank src attributes of a few tags: * <script src=""> * <iframe src=""> * <link href=""> * <img src=""> Whenever any media/page is referred with a ...
user avatar
  • 1,291
3 votes

How do I generate a SEF URL in a custom module instead of the real URL?

Here is another way of getting the correct root URL of the site. This also takes care if your site is in subfolder $rootURL = rtrim(JURI::base(),'/'); $subpathURL = JURI::base(true); ...
user avatar
3 votes
Accepted

My 404 page returns a 500

In libraries/legacy/controller/legacy.php we changed: throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_VIEW_NOT_FOUND', $name, $type, $prefix), 500); to throw new Exception(JText::...
user avatar
3 votes
Accepted

Joomla Menu Structuring

The simplest way to achieve the URL structure you mention is to create a Category called "News" and create your news articles in this category. This will give you a structure like: www.example.com/...
user avatar
  • 106
3 votes

Modify standard redirect url after session time out

You could write a template override for the login template being called when the standard login url is displayed. There you create a HTTP 302 Move response status. Or you write a url rewrite to your ....
user avatar
  • 368
3 votes

Joomla 3.0 direct link to file with multi language

That's a bit strange, I guess it should be related to how you have linked the pdf. From where you link the pdf? In any case a direct hard-coded link to the pdf file like: images/sample.pdf ...
user avatar
  • 19.5k
3 votes

How Can I Get Rid Of Category Pages in Joomla

This post highlights a common problem with Joomla and other CMSes. Without the correct setup many different URLs can be indexed for the same page. Joomla applies an ID for each category and each item....
user avatar
  • 320
3 votes

Use Joomla redirect component to fix broken URLs

What you could do is use Joomla's Redirect Manager to redirect the old URL to the new one. In the Joomla backend, go to: Components >> Redirect >> New In the Source URL field, enter the old URL and ...
user avatar
  • 26.4k

Only top scored, non community-wiki answers of a minimum length are eligible