Redirect Action Difference between Joomla 3 and Joomla 4

Redirect action not working correctly after migrating from Joomla 3 to Joomla 4.

Overview

The issue is caused by Joomla 4 no longer automatically inserting the Itemid (menu ID) into URLs, which breaks internal redirects.
To fix this, modify the redirect function file to manually append the active menu's Itemid to the URL parameters.

Answered
ChronoForms v7
Co Colnem 05 Feb, 2022
Hi Guys

To see the big difference in V7 Redirect Action between Joomla 3 and Joomla, look at this page:
https://ecole.olympe-retraite-sportive.com/index.php/cf7
You can test a same CF7 Form using Redirect Action on a Joomla 3 Site, then a Joomla 4 Site.

Please, say me what you're thing about this...

Edit: 7-2-2022:

To see why CF7 Redirect doesn't work with Joomla 4...

https://joomla.stackexchange.com/questions/31618/joomla-4-no-longer-inserting-the-itemid-the-current-or-active-menu-in-the-url

There is a soluce updating /library/src/Router/SiteRouter.php.

I've tried: it works! But you have to redo after every upadte version of Joomla 4!
Co Colnem 08 Feb, 2022
Answer
Edit: 8-2-2022:

Waiting the developer find a definitive soluce, I've found this:

File: \administrator\components\com_chronoforms7\chronoforms\functions\redirect\redirect_output.php
Add lg 26 : if(!strpos($url,$_SERVER['PHP_SELF'])) $url=str_replace('index.php',$_SERVER['PHP_SELF'],$url);

It works....

Bye
Co Colnem 18 Feb, 2022
Hi

In J4, Itemid is hidden. So when you use Redirect Action toward another page of the same form, results are displayed in home page.

A better solution to fix this problem with Joomla 4:
file: /administrator/components/com_chronoforms7/chronoform/function/redirect/redirect_output.php
line 26: $url = \G3\L\Url::build($url, $params).'&Itemid='.\JFactory::getApplication()->getMenu()->getActive()->id;

No tested with J3 (not necessary inJ3).
This topic is locked and no more replies can be posted.