Prevent malformed URLs

Created on 21 January 2016, over 9 years ago
Updated 16 May 2025, 3 days ago

I have several panels pages with a simple URL:
/employees

If someone types "/employees/randompage" I want a 404 page to be returned. I understand that the default Drupal behavior is not to 404 in that situation because "randompage" might be a valid argument.

The workaround is usually to add another variant, check for an argument (i.e. any text) after "/employees" and return a 404 if there is something there.

This will require altering all the panels page on a large instance, updating all the Features and deploying it across over a dozen sites (for different geographies/languages). Not trivial. Plus, every panel page would need this construction going forward.

Instead, I'd like to do what the Views 404 modules does ( https://www.drupal.org/project/views404 β†’ ). That module uses hook_views_pre_view() to get the job done.

I've looked for a similar hook in Panels and can't seem to find one. Does one exist? If not, is there another way to do this in a central location? I don't want to put anything in hook_outbound_url_alter().

πŸ’¬ Support request
Status

Closed: outdated

Version

3.5

Component

API

Created by

πŸ‡ΊπŸ‡ΈUnited States aangel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024