?
avatar vintzl
vintzl
14 Aug 2020

Steps to reproduce the issue

Creating a custom 404 page following this. Set a page heading.

Expected result

Get the 404 page heading.

Actual result

Get the home page page heading…

System information (as much as possible)

Joomla Beta 3 from here :

Additional comments

Tested with a clean install…

avatar vintzl vintzl - open - 14 Aug 2020
avatar joomla-cms-bot joomla-cms-bot - change - 14 Aug 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Aug 2020
avatar brianteeman
brianteeman - comment - 14 Aug 2020

This page has been archived. This page contains information for an unsupported Joomla! version or is no longer relevant. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

avatar brianteeman
brianteeman - comment - 14 Aug 2020

What is missing from those instructions is setting a hidden menu item for that article. Otherwise it will use the default itemid and therefore display any modules or menu params (such as the page heading) of the default menu item

avatar vintzl
vintzl - comment - 14 Aug 2020

I tried with hidden menus, but I get the same result.

Maybe I am doing something wrong, but do not see what.

avatar vintzl
vintzl - comment - 20 Aug 2020

I noticed something.

If I access any URL following this format:

  • /index.php?option=com_content&view=article&id=2

I get the page_heading from the HOME page instead of the actual URL.

As in this case, $this returns all data from the HOME page.

                $menu = JFactory::getApplication()->getMenu();
                $active = $menu->getActive();
                $heading = $active->params->get('page_heading');
avatar brianteeman
brianteeman - comment - 20 Aug 2020

Yes that is correct because the URL doesnt have an Itemid
An Itemid ties the link to a menu item and if it doesnt have one then it uses the default

avatar SharkyKZ
SharkyKZ - comment - 20 Aug 2020

Use Joomla\CMS\Router\Route::_() to get the correct URL. Though I wouldn't recommend following that guide. Such custom error page sends the wrong header (302 instead of 404). You should look for a plugin instead.

avatar vintzl
vintzl - comment - 20 Aug 2020

Yes that is correct because the URL doesnt have an Itemid
An Itemid ties the link to a menu item and if it doesnt have one then it uses the default

I am not sure I understand, as in my cases, all articles have an entry in menus.

Anyway, it can be very dangerous with negative SEO attacks.

  1. Joomla lacks native support of canonical tag…
  2. URL don't have an Itemid?

Because of the two previous points, by default, all websites under Joomla are vulnerable to duplicate content attacks…

I just need to copy/paste the raw url here and there, and slowly but surely, I will see the target decline in SERP…

To protect websites I am working on, I wrote some code to generate canonical tag from raw urls, but I am not sure to consider all combinations, as articles and categories are accessible from these URLs:

  • index.php?view=article&id=[0-∞]:home&catid=[0-∞]
  • index.php?option=com_content&view=article&id=[0-∞]

so a single article/category is accessible from

  • index.php?view=article&id=2:home&catid=[0-∞]
  • index.php?option=com_content&view=article&id=2

Therefore, I wonder if I should forbid direct access from raw URLs.

avatar vintzl vintzl - change - 22 Aug 2020
Title
Joomla 4 — Buggy 404 Page heading
Joomla 4 — Buggy Page heading when pages are accessed from raw URLs
avatar vintzl vintzl - edited - 22 Aug 2020
avatar Hackwar
Hackwar - comment - 17 Mar 2021

Unfortunately the above tutorial is highly misleading. As others have said, this returns the wrong response code AND you need to have a menu item for your error article AND wrap your URL with a JRoute::_(). This isn't a bug in Joomla.

avatar HLeithner HLeithner - change - 18 Mar 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-03-18 05:37:17
Closed_By HLeithner
avatar HLeithner HLeithner - close - 18 Mar 2021

Add a Comment

Login with GitHub to post a comment