Module should be add a redirect from old alias to 'node/nid' when remove alias. Now when I type old URL I get an 404 error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kubala.webdesign’s picture

Title: Redirect from old path to node/XXX when remove alias » Redirect from old path to node/XXX after alias having been removed
kubala.webdesign’s picture

Status: Needs work » Patch (to be ported)
FileSize
1017 bytes

that patch solved problem

/Edit: orphaned redirects after delete node, infinity loops :/ I'll work tomorrow on that..

kubala.webdesign’s picture

Status: Active » Needs work
John Pitcairn’s picture

Status: Patch (to be ported) » Needs work

subscribe

cmseasy’s picture

Maybe "rules" can help here? See #13 at http://drupal.org/node/808028.

kubala.webdesign’s picture

Status: Needs review » Needs work
FileSize
5.08 KB

patch for redirecting from old alias to node/_nid_ after alias having been removed in attachment.
It's also solve bug described in #648598: Duplicate entry 'node-' for key 2 query: INSERT INTO path_redirect, by checking nid in nodeapi and looking for duplicates in path_redirect_check_alias_changed and update existing row when it's recommended.

I tested it, everything is OK, but it's small bug (i think in path module) with apostrophes. I also add few stripslashes() and addslashes() function to prevent SQL Injection (let's imagine situation where redirect = "something' or redirect = 'another_redirect", and we try delete node with that alias..).

I also replace path_redirect_delete_multiple() by my own function to make orphaned redirects impossible.

PLEASE REVIEW THIS.

Sorry for broken english, i hope you're understand me ;)

kubala.webdesign’s picture

Status: Needs work » Needs review
mikeytown2’s picture

Status: Needs work » Needs review

subscribe; plan to test soon.