It appears that just editing and saving a node can cause a redirect to be deleted.

To recreate:

1) use pathauto to generate an alias for a node, ex: auto-path (not sure this step is necessary)
2) edit the node (note there are 0 redirects)
3) uncheck the box to automatically generate an path alias, and
4) edit the existing path, ex: man-path-one
5) save the node.
6) edit the node again (note that there is 1 redirect - yay!)
7) save the node.
8) edit the node again (note there are 0 redirects - wut?!)
9) check the box to automatically generate a path alias, ex: auto-path
10) save the node
11) edit the node (note there is 1 redirect now - yay?)
12) uncheck the box to automatically generate a path alias
13) change the URL slightly, in a different way than in step 4, ex: man-path-two
14) save the node
15) edit the node (note there are 2 redirects now - yay?)
16) save the node
17) edit the node (note there is 1 redirect now - wut?!?!)

I'm not entirely sire what *should* be left of my redirects at this point, since I've changed my paths back and fourth, but it seems that when I think everything is working as intended (when all my expected redirects are showing on the edit screen), saving the node deletes one of my redirects.

Comments

jbrauer’s picture

Version: 6.x-1.0-rc1 » 6.x-1.0-rc2

I can confirm this is happening. What seems to be required is:

1) Create a pattern for path-auto pages/[raw-title]
2) Create and edit the node giving it a title of test.
3) Change the path to be something/not/auto (uncheck the auto box to do so)
4) Create any path redirects desired. -- save/preview changes etc.
5) Add a path redirect from pages/test -> node/123 (whatever the node is)
6) Edit the node and save or preview changes and the path redirect will be deleted.

A workaround seems to be you can create the path redirect on the URL Redirect page but the target MUST NOT BE the node/### version it has to be the alias for the page. The downside is this doesn't show up on the node edit page when editing the node.

miccil’s picture

Same problem for me.
Any solution?

miccil’s picture

I found a quick fix.
In pathauto (6x-1.5 version) module I commented Line #28 of pathauto.inc

// path_redirect_delete_multiple(NULL, array('source' => $alias, 'redirect' => $source));

This line delete path redirects to specific node created from path_redirect module on node edit.

I updated pathauto general settings setting
"Create a new alias. Delete the old alias." on "Update action" section

and path_redirect settings setting "Automatically create redirects when URL aliases are changed." to on.

This seems to work for now.

miccil’s picture

I found this issue that confirm my idea
http://drupal.org/node/950042

YK85’s picture

subscribing

Drake’s picture

sub

jelo’s picture

Sub

gooddesignusa’s picture

sub

roderik’s picture

Status: Active » Closed (duplicate)

Yup, it's a problem with the code of pathauto, not path redirect.
Indeed, watch #950042: _pathauto_alias_exists() deletes redirects on node edit (before save) for nodes with manually edited paths for developments.

Another quick fix for now, which does not change code, is installing the little pathauto_persist module. This has the side effect of the offending code in pathauto never being executed.