If path redirect is installed provide new update option "Make old alias a redirect and create new one"

greggles - December 1, 2006 - 16:34
Project:Pathauto
Version:5.x-2.0-beta4
Component:Code
Category:feature request
Priority:normal
Assigned:jjeff
Status:closed
Description

The Path Redirect module is a great module to help with the duplicate content problem.

I've been thinking for a while that Pathauto should provide a further "Update action:" to users:

Create a new alias, make the old one a redirect

This would do basically as it says - rather than just replacing the old one it would take the old one and make it a redirect. There is a problem of what kind of redirect to make it (302, 301, etc.). My preference is 301 but it should be user configurable - probably within the Path Redirect module as a default for new ones that Pathauto would then respect.

If the Path Redirect module is not installed this option would be greyed out.

Thoughts?

#1

TheWhippinpost - December 2, 2006 - 00:51

Heh, I only read as far as the first line and immediately thought, "Yes!".

I agree WRT: 301 preference since the old duplicate URL is effectively dead - However, I guess the additional options might prove useful for some users and their various scenario's... could always be removed at a later date if it's existence is felt to be redundant.

(My perfection-fetish-side-of-me though say's the dupes should be deleted to save DB space and user-confusion ;) )

+1

#2

inactivist - January 5, 2007 - 01:04

While I like (and want) this feature, it seems odd (to me) to put it in pathauto - after all, if I never use pathauto, this feature would not help me - what about those who don't use pathauto?

If path_redirect is installed, it would be way cooler to have that module detect the path alias changes (on node edits) and do the right thing. Then, no need to modify pathauto. Not sure how this would be done, though.

#3

greggles - January 5, 2007 - 04:51

Probably the best way to find out if this could be implemented in path redirect is to use the issue queue for that module instead of this one.

Did you create such an issue?

I don't think it's possible, but I won't be implementing this feature for a while so maybe it is...

#4

inactivist - January 8, 2007 - 19:56

No, I've not yet created a suggestion in path_redirect - I will do so ASAP. Thanks for all the feedback.

#5

MikeyLikesIt - February 2, 2007 - 02:51

I not aware of what triggers are available to set off this action, but ideally this action could be triggered any time the path for a node is updated.

When a node path is updated:

  • the user receives a message notifying them of the update. I think this functionality already exists.
  • add an additional prompt to the message which contains a link to the path redirect creation page with the appropriate values filled out.
  • user submits the path redirect form and is finished.

It would also be great to have a global setting somewhere that would allow this to be done automatically any time a node path is updated, but having this manual interface provides the flexibility needed by some users.

#6

jjeff - October 7, 2007 - 20:06
Version:6.x-1.x-dev» 5.x-2.0-beta3
Assigned to:Anonymous» jjeff
Status:active» patch (code needs review)

Here's a patch that is tested and working with Path Redirect 1.1-beta1.

If Path Redirect module is enabled, another option appears -- "Create a new alias. Redirect from old alias." If this option is chosen, old pathauto paths will get saved as redirect paths that redirect to the new alias for the node.

This essentially means that all old aliases for a node become redirects to the current alias. It's pretty slick! :-)

Please test and post successes/problems. Thanks.

AttachmentSize
pathauto-redirect.patch3.07 KB

#7

greggles - October 21, 2007 - 15:50

Excellent stuff!

So, this was calling the path_redirect_save($save) even if there was no old alias - i.e. even if it was the initial creation of a node. This had the effect of creating a single entry in the path redirect system that pointed at the most recently saved node.

The attached patch attempts to fix that by adding an if to check for the old alias. Thoughts? I think it's ready to commit.

AttachmentSize
pathauto_path_redirect.patch3.63 KB

#8

jjeff - October 22, 2007 - 20:10

Eek! Good fix.

I'm down if you're down.

Commit away!

#9

greggles - October 22, 2007 - 20:25
Version:5.x-2.0-beta3» 5.x-2.0-beta4

Very nice. Applied to the 5.x-2 branch.

#10

greggles - October 22, 2007 - 23:33
Status:patch (code needs review)» fixed

*cough*

#11

Anonymous - November 12, 2007 - 22:41
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#12

MikeyLikesIt - November 14, 2007 - 05:36

A big thanks! MikeyLikesIt

This will help with SEO a lot.

 
 

Drupal is a registered trademark of Dries Buytaert.