The “Rebuild” Button In Joomla’s Menu Manager Page – A Double Edged Sword!

You have probably seen the “Rebuild” button on the Menu Manager page on your Joomla website for some time, but most likely you haven’t pressed it – because you didn’t know what it is, and perhaps you thought: “Maybe it’s not such a good idea to press that button”. Well, we think you’re right!

So, what does the Rebuild button do?

The rebuild button simply re-creates the paths of each menu item based on its alias, as well as the path of its parent item. Additionally, it fixes the lft and rgt fields on your website (the lft and rgt fields are beyond the scope of this post – let’s just say that if they are wrong then you will have issues with your Joomla website). For example, let’s say you have a root menu item called Products that has an alias field of products. Let’s also say that you have a child menu item (of the Products menu item) called Product 1. Assuming that the latter’s alias is product-1, then the natural path of that menu item is: products/product-1.

So far so good…

But, what if your menu item is not using a natural path?

Let’s say that you have a component that manually modifies menu items’ paths. For example, instead of having the above path as products/my-product, the component saves it as products/1-product, or maybe it saves it as my-products/product-1. Pressing on the Refresh button will change the path back to product/product-1, which is most likely something that you do not want; what if you have many internal and external links pointing to my-products/product-1, and all of a sudden that link on your website no longer exists?

So, what is the point of having a Rebuild button?

The Rebuild button is Joomla’s attempt to fix menu item issues caused by 3rd party extensions (that update menu items). For example, we had a case yesterday where one of our clients was creating a perfectly normal menu item, but that menu item was not working on the website (it was returning a 404 – Article Not Found or a 404 – Category Not Found – the first error was returned when the alias didn’t have a dash inside it, the second one happened when the alias did have a dash). Clicking on the Rebuild button fixed the problem – unfortunately, it created an array of issues with many other menu items. So, while the Rebuild button may break many links on your website (which paths are modified by 3rd party extensions), it may also fix some issues you’re having with menu items.

But shouldn’t Joomla fix itself automatically?

In all fairness, it shouldn’t. Extensions that update menu items should be meticulously written – otherwise, they can break the website. Joomla’s Rebuild button is just attempting to fix their mess, but by fixing their mess, it might create more mess.

However, Joomla should take into consideration customized menu items – this can be solved by having a field (in the #__menu table) that will state whether a menu item has been customized or not, so that it’ll be ignored (by it we are referring to the menu item) when the Rebuild button is pressed. This is the best solution to handle this issue – but not the perfect solution, because Joomla may need to still update the lft and rgt fields of this row for data integrity reasons.

Now – let’s talk about you. If you’re having problems with menu items, or if you clicked the Rebuild button and all hell broke loose, then fear not – we are there for you. Just contact us and we’ll help you fix your website in record time and for a very small cost!

3 Responses to “The “Rebuild” Button In Joomla’s Menu Manager Page – A Double Edged Sword!”
  1. Comment by Alessandro — December 2, 2015 @ 1:35 pm

    Hi, I have the same issue you described in the article “The Rebuild Button In Joomla’s Menu Manager Page – A Double Edged Sword!” and I am wondering if you can help to fix it.

    Our website is running on Joomla! 2.5.27 platform, the main extensions installed are:

    Virtuemart v. 2.6.20
    K2 v. 2.6.9
    K2mart v2.0.5

    And many others, but we don’t have any SEO or SEF component in use.

    Apparently the issue come from Virtuemart, for instances when we save any Joomla menu item the URL becomes corrupted by adding the following to the original URL:

    /com-virtuemart-menu-products/com-virtuemart-menu-orders/com-virtuemart-menu-orders/com-virtuemart-menu-report/com-virtuemart-menu-report/com-virtuemart-menu-users/com-virtuemart-menu-manufacturers/com-virtuemart-menu-store/com-virtuemart-menu-store/com-virtuemart-menu-mediafiles/com-virtuemart-menu-mediafiles/com-virtuemart-menu-shipmentmethods

    By checking in the Joomla backend, the alias is correct, but in the database the data stored is as above.

    I look forward to hearing from you.

    Best Regards
    Giusti Alessandro

  2. Comment by Fadi — December 23, 2015 @ 3:29 am

    Hi Alessandro,

    There is definitely some corruption in your menu causing this mess. You will need to examine the data carefully in your #__menu in order to find where the problem is (my guess is that it’s just one or a few rows in the table causing this).

  3. Comment by David — March 18, 2016 @ 10:19 am

    Thank you for this article, I was modifying the structure of my categories and wondered if I needed to hit the “rebuild” button to make it stick. Glad that I read this article first.

Leave a comment