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?

Comments

TheWhippinpost’s picture

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

mcurry’s picture

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.

greggles’s picture

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...

mcurry’s picture

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

OpenChimp’s picture

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.

jjeff’s picture

Version: 6.x-1.x-dev » 5.x-2.0-beta3
Assigned: Unassigned » jjeff
Status: Active » Needs review
StatusFileSize
new3.07 KB

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.

greggles’s picture

StatusFileSize
new3.63 KB

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.

jjeff’s picture

Eek! Good fix.

I'm down if you're down.

Commit away!

greggles’s picture

Version: 5.x-2.0-beta3 » 5.x-2.0-beta4

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

greggles’s picture

Status: Needs review » Fixed

*cough*

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

OpenChimp’s picture

A big thanks! MikeyLikesIt

This will help with SEO a lot.

summit’s picture

Version: 5.x-2.0-beta4 » 7.x-1.x-dev
Status: Closed (fixed) » Active

Hi, opening this issue again for the D6 branch.
Would it be possible to also commit this functionality to the D6 branch?
Thanks a lot in advance for considering!
Greetings, Martijn

greggles’s picture

Status: Active » Closed (fixed)

This was applied to 5.x-2.x before we branched for 6.x so it is included in 6.x.

summit’s picture

Great thanks for the update, greetings, Martijn

sirkitree’s picture

Status: Closed (fixed) » Patch (to be ported)

I'm not seeing this in the 7.x - reopening?

dave reid’s picture

Status: Patch (to be ported) » Closed (fixed)

The option is in the Redirect module settings for creating redirects when URL aliases change. This option is not in Pathauto anymore.