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().

Comments

aangel created an issue. See original summary.

mingsong’s picture

I developed a module for it.

https://www.drupal.org/project/ctools_valid_path_arguments

This is module provide a selection rule for panel to verify page argument or just rule out any additional path.

aangel’s picture

Status: Active » Closed (outdated)