Renaming node: old URL is gone

Lexas's picture

Hello guys.

I'm using Pathauto with Global Redirect, but there is an issue that they don't solve.

Let's say I have a node and after some time I decide to change its name. Then I go and change its URL to fit the new name, Pathauto doesn't do that so I just uncheck Automatic alias and change its URL.

The problem is that the node remains with the old URL, I don't know why it is not changed. And both old and new URLs return the same content, letting it duplicated.

The solution for the new URL being properly is go to URL aliases page, delete everything related to this node, and adding it manually. Buth with that, old URL is gone and returns 404 error page. Then I go to htaccess and add to it the old URL, redirecting to new one...

My intention is that the system URL and the old URL are both redirected to the new one, so that we have no duplicate content and also search engines and bookmarks are redirected to the new URL, and of course having it done automatically. And to make it perfect, this should work on any number of URL changes, keeping a list of all old URLs and redirecting all of them to the new one.

Any tip on how I can get this working? I looked for a module and the closest I found was path_redirect, but is not automatic, so it would be better to do it manually on htaccess.


Use htaccess

guldoe's picture

i have a multisite drupal. Each site has it owns nodes, but one site and default site are the same. I use htaccess to control it.

Well I tested Path Redirect

Lexas's picture

Well I tested Path Redirect and it works better than I thought compared to htaccess.

To change nodes URL, I must go go URL alias and delete it, create a new alias (leaving node edition page alone) and use Path Redirect to redirect old URL to new one.

But I'd like something automatic and that didn't need to go thou all those modules. Just go to 1 page, set the new URL and it does everything else automatic.

Well at least it is doable, and I won't need to change URLs so often at all.

PathAuto v2? :)

DamienMcKenna's picture

I've been thinking about this lately too and wonder if we could persuade the PathAuto maintainers to work as follows:

  • Support global_redirect's ability to cleanly redirect users from "node/123" (ugly URL) to "articles/my-cool-post" (pretty URL).
  • Recognize if path_redirect is installed. Have an extra option to handle path changes that would create a redirect in {path_redirect} for the old URL. It would also recognize if the new path was already in {path_redirect} and remove it.

These two steps would provide a clean(er) structure to handle URL changes.

This can be done developing

Lexas's picture

This can be done developing a new module.

It would have a list of all nodes to choose, then show a readonly editbox with the current URL and another editbox to insert new URL.

After confirmation, it would remove the alias row, insert the new one and insert the proper row in path redirect table.

That's not hard to be done, it's pure SQL, the problem is learn how to develop a Drupal module :P

already done

greggles's picture

This is actually already done.

  1. Install path redirect.
  2. Look in general settings at the "Update action"
  3. It is already there :)

Growing Venture Solutions | Drupal Dashboard | Learn more about Drupal - buy a Drupal Book