Getting Pathauto to change ALL the URLs

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
gallamine's picture

I'm using Pathauto to clean up the nasty Drupal URLs. So, I have a content type "project" and the URLs to these projects are like: /project/projectname

However, when I'm viewing that project, the "Edit", "What Links Here", and "Who's Bookmarked" links at the top is still linking to the old nasty Drupal urls, like "/node/175/edit".

Does anyone know of a way to change this? I can't seem to find any answers on the intertubes.

Comments

Good question

knieveltech's picture

This got me sufficiently curious that I spent some time poking around in pathauto's CVS repository on Drupal.org. The following is taken from README.txt:

"Pathauto just adds URL aliases to nodes, users, and taxonomy terms. Because
it's an alias, the standard Drupal URL (for example node/123 or
taxonomy/term/1) will still function as normal. If you have external links
to your site pointing to standard Drupal URLs, or hardcoded links in a module,
template, node or menu which point to standard Drupal URLs it will bypass the
alias set by Pathauto."

In a nutshell what's happening is pathauto is creating a rewrite for ?q=node/<nid> only. This seems to make sense considering pathauto's goal in life is to create SEO-friendly URL's and considering most folks probably don't want the node edit urls indexed anyway, aliasing these as well would add unnecessary clutter.

So to answer your question it appears that you would need to either write a custom module to create aliases for these additional paths or hack up a copy of pathauto.

Changing the Menu Path on the Edit Page

JuliaKM's picture

I think that you might be able to do this by creating a new module and building a new alias each time you edit a node using hook_nodeapi.

@Allen: Do you think this could work?

I'm really couldn't say

knieveltech's picture

nodeapi is one of the core hooks I haven't needed for anything yet so I haven't had a chance to look at it closely. Assuming it does work though you're creating three or more rewrite rules for every node in the database, any number of which are pointing to utility pages you wouldn't want indexed anyway. It'd probably make for a cool coding exercise but I would probably avoid doing anything like this on a production site unless there was a defined need.

One way to create edit aliasses

joris_lucius's picture

<?php
/<em>
</
em> Implementation of hook_nodeapi
*/
function
example_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {

  switch (
$op) {
    case
'view':
       
// Set path alias, for editing alias
        // Function will prvent dupicates
        // Downside: function will be triggered each time node is viewed
       
path_set_alias("node/".$node->nid .'/edit', $node->path ."/edit");
      break;       
  }   
}
?>

triDUG

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: