I am using the pathauto module to alias the content paths of the nodes. The pattern for the Page paths is e.g. [node:title] or mysubfolder/[node:title]. So the path of the node is now www.mysite.com/nodetitle instead of www.mysite.com/node/nid.
But this also means, that the path for the edit-tab is now www.mysite.com/nodetitle/edit instead of www.mysite.com/node/nid/edit. And www.mysite.com/nodetitle/edit results a 404-error.
The same is true for other tabs in the node, used by other modules (in my case the feeds-module with the tab 'log' and the webform-module with the tabs 'webform' and 'webform-results'.
To get this working again I extended the function fast_404_validate_path_sql() in fast_404.inc with the following lines:
$admin_pages = array('edit', 'log', 'webform', 'webform-results', 'delete');
// Check tab with subfolder (www.mysite.com/subject/mynode/edit)
if (isset($path_parts[2])) {
if (in_array($path_parts[2], $admin_pages) == TRUE) {
$node_alias = $path_parts[0].'/'.$path_parts[1];
}
}
// Check tab without subfolder (www.mysite.com/mynode/edit)
elseif (isset($path_parts[1])) {
if (in_array($path_parts[1], $admin_pages) == TRUE) {
$node_alias = $path_parts[0];
}
}
// Check if if node_alias exists
if (isset($node_alias)) {
$node_alias_stmt = $pdo->prepare("SELECT alias FROM url_alias WHERE alias = :alias");
$node_alias_stmt->execute(array(':alias' => $node_alias));
if ($node_alias_stmt->fetch()) {
return TRUE;
}
}
Comments
Comment #2
smitty CreditAttribution: smitty commentedThe same problem appears for the contact form of aliased users (www.mysite.com/mysubfolder/username/contact instead of www.mysite.com/user/uid/contact) and all views using the a path like /user/%/mysubject resulting in www.mysite.com/username/mysubject.
Comment #3
vensires CreditAttribution: vensires commentedPathauto doesn't alias the node/[nid]/edit, node/[nid]/devel, node/[nid]/* menu items. All it does is alias the node/[nid]. Same goes for taxonomy and users menu items/tabs. That's why the me module was created, to target this feature specifically for users. If you have seen this behavior in action, I suspect another (custom?) module added it.
If you want to set this to active, please add more details about which module adds the behavior you described before.
Comment #4
smitty CreditAttribution: smitty commentedI wasn't aware that I have installed not only the pathauto module but also the sub-pathauto module (https://www.drupal.org/project/subpathauto). I Installed it a long, long time ago ;-)
So: The described behavior is added by the sub-pathauto module.
The described problem is also addressed in in https://www.drupal.org/node/2471983.
Comment #5
smitty CreditAttribution: smitty commentedComment #6
vensires CreditAttribution: vensires commented