By default, pathauto gives nodes the link /content/title-of-node. For user submitted links using the autocomplete feature, related links creates its link as node/nid.

When a user clicks on the link, they end up at /content/node/nid and a 404 error.

Patch makes two changes to use the l() function when outputting links and not use url() when inserting links into the database.

CommentFileSizeAuthor
wrongurls.patch1.02 KBalbert_philly

Comments

kingandy’s picture

FWIW, I don't think it's fair to blame this on pathauto - it's just how web browsers handle what appears to be a relative link (ie, no leading slash or protocol). If you were looking at /node/nid and clicked on a href="node/nid" link you'd find yourself at /node/node/nid ... TBH I'm surprised to find a hardcoded link like that hanging around in what is otherwise a finely-crafted module. I suspect that and the url() usage are both throwbacks to a darker time, a time when the $_GET['q'] reflected the path in the URL rather than the internal system path.

Cheers for this patch, just what I was looking for :)

Zen’s picture

Title: Bug when used with pathauto » Bug when used with path aliases
Version: 5.x-2.2-beta » 6.x-1.x-dev
Assigned: Unassigned » Zen
Status: Needs review » Fixed

I believe that this should now be fixed. Thanks for the patch :)

Status: Fixed » Closed (fixed)

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