Joomla version 4.3.3, Cassiopeia template.

I have a module that I'd like to display only on the Home page. I have a home page menu item which is linked to a single article.

In the module options I link the module to be displayed on the Home page menu item and it displays correctly.

The problem is that if I link to any other area of the site using this form: mysite/index.php?option=com_content&view=article&id=1401 then the module displays there too.

I have installed the Advanced Module Manager and set it to exclude links which contain the string 'option' - this gets around the problem so it suggests that Joomla treats any url that has 'index.php' as the home page? I think I must have misunderstood something - can anyone explain?


2 Answers 2


The problem with the above link is that your missing the ItemId which explicitly specifies which menu item is associated with the link, thus ensuring that modules are displayed on the proper pages. If you use Joomla's SEF then you won't have this problem, as the SEF plugin will properly guess the menu item ID for each page, allowing for the right modules to be displayed.

  • Thank you for the helpful pointer. I also found your article here itoctopus.com/… which explains a bit more.
    – zoe
    Aug 11, 2023 at 9:33
  • In your article you say: “If you remove the ItemId from the URL of a certain page, then only those modules assigned to all pages or those assigned to all pages except those selected will display on that particular page.”. But this is not what I am seeing.
    – zoe
    Aug 11, 2023 at 9:33
  • The module I want to display on the home page is appearing on ALL pages that are linked without using an Itemid. I have other modules on different pages and they don't show up in the wrong place - it's just an issue with the home page.
    – zoe
    Aug 11, 2023 at 9:33

To answer in more general terms your question of understanding;

I think I must have misunderstood something - can anyone explain?

Putting aside SEF for the moment, turn it off if you will.

Any page displayed from Joomla is going to have an ?option=com_something as part of the URL as this part of URL Query tells Joomla what Component is to be displayed. For example displaying articles, Blogs or Lists, it will be ?option=com_content, for the Contact pages it will be ?option=com_contact and any number of 3rd party Component extensions will have their ?option=com_nameofcomponent

Therefore using something like AMM to exclude any links that contain ?option is really not the solution here as all URL's are going to contain an option in some form.

The index.php is the entry point for any link to start Joomla, this file is what is executed to for every request for Joomla from the browser and has nothing to do with whether it is a homepage or any other page, it is always there to tell the browser which file will start Joomla. To not display the index.php in the URL you need to select 'Use URL Rewriting' as part of using the SEF URL's, index.php can not be removed/hidden as part of the non-SEF URL.

What tells Joomla that a page is the Homepage is where the yellow house icon is set against a menu item in Joomla, see image. Internally Joomla processing will be saying if you haven't told me to display a specific page or menu item then display the default page, the one displaying the yellow icon. enter image description here

There is nothing in the URL to distinguish a page as being the Homepage or not, however the current menu id is displayed as &itemid=nnn. Therefore if you know that the Homepage menu id is 101, as in my image above, then &itemid=101 will appear in the URL and you can respond to that, but again there is nothing in the URL that says you are on the Homepage.

A key component of Joomla called 'The Router' plays an important part in that it takes the Query from the incoming URL, that is everything to the right of the first '?', and breaks it down to determine what Joomla is to do with the request. This determines the Component/Extension(option=com_something), the page to displayed(view=fred), the command or action to be taken(task=barney), the record in the database to be used(id=), the page layout to use(&layout=wilma) and so on including the menu to be used(&itemid=). The option is the only one that appears in all URL's and the rest will be dependant on the component being called.


The second part of 'The Routers' job is when Joomla is preparing a page to be displayed it will go through all the links, internal ones, and do things like add the 'https://mydomain' to the front of each link and make sure they are correctly formed so that when selected on the page the URL provided will get processed, parsed, correctly by the incoming part of 'The Router'.

When your turn on SEF that is telling 'The Router' that when preparing the links on a page to change them from the non-sef format to the SEF format, that is converting them from


to https://mydomain/index.php/products

And conversely when 'The Router' receives the incoming SEF formed URL Query it will convert the URL Query back to the non-SEF URL before processing the URL to determine what action Joomla is to take.

To answer your question in the comments of @itoctopus's answer, no you don't have to go through and change every occurrence of the index.php/?option. With SEF and URL Rewriting turned on the Router will do that dynamically when each page is being built.

Between earlier versions of Joomla 3 and Joomla 4 there was some major changes to the way 'The Router' works that can cause some strange behaviour with older Joomla 3 style links coming into a Joomla 4 site, such as those stored by Google and other search engines.

Therefore it is best to get the Joomla 4 site behaving the way you want it to, using SEF URL Queries, and ignore the older Joomla 3 syle incoming links. Eventually search engines will update the older links they have stored.

If you want to deal more actively with the older links then you can look at the Redirect extension of Joomla or an equivalent 3rd party extension.

As @Itoctopus has pointed out the older style links that don't have an &itemid= will use the default menu id, the menu specified as the Homepage, and thus your module reappears on pages where it is not wanted.

  • Thank you for taking the time to write this down – it’s very helpful. The key thing that I did not understand was that if an Itemid is missing the home page ID will be used by default, although I suppose that should have been obvious.
    – zoe
    Aug 12, 2023 at 10:05
  • Fixing all the internal links sound like the best solution, as you suggested – none of them worked when we upgraded from J3 either so I know where they all are.
    – zoe
    Aug 12, 2023 at 10:06
  • Looking at this joomla.stackexchange.com/questions/31618/… I also think that J3 was helping me out by appending Itemids in a way that J4 no longer does?
    – zoe
    Aug 12, 2023 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.