Problem/Motivation
When saving a menu, the user will by default be redirected to the menu top level at admin/structure/menu/manage/. This would happen even when saving a "child menu" menu at admin/structure/menu/manage/?menu_link=menu_link_content.
This module alters the redirect destination so that the user would stay in the child menu instead of being redirected to the top level. This is very convenient.
However, if Drupal is installed in a subdirectory or behind a reverse proxy, in an address like example.com/drupal/, then this custom redirect does not work as intended, but instead redirects the user to /drupal/drupal/admin/structure/menu/manage/?menu_link=menu_link_content (note the double folder name at the beginning).
Steps to reproduce
- Install Drupal in a subdirectory, eg example.com/drupal/
- Go to admin/structure/menu/manage/main, add links in multiple levels
- Click "Edit child items" to edit a child menu
- Save the child menu
- You should now see the Drupal 404 page, and the URL should start with /drupal/drupal/...
Proposed resolution
- Option A: Remove the call to
$form_state->setRedirectUrl(), and disable the redirect completely using$form_state->disableRedirect() - Option B: Remove the call to
$form_state->setRedirectUrl(), and add ?destination parameters to the "Edit child items" links
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3247189-3-option-b.patch | 2.39 KB | rade |
| #2 | 3247189-2.patch | 661 bytes | rade |
Issue fork bigmenu-3247189
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
rade commentedAttaching patch for proposed solution, option A.
Comment #3
rade commentedAnd here is a patch for proposed solution, option B.
Comment #4
nigelheinsius commentedThree years on from this original post by Rade. I am still experiencing this issue. My fix is a one-liner in the .htaccess file:
RewriteRule ^SUBDIRECTORY/admin/structure/menu/manage/(.*)$ /SUBDIRECTORY/admin/structure/menu/manage/$1 [L,NC,R=302]