So on my site we are doing custom_url_rewrite along with path aliases. The issue I am running into is that drupal_get_normal_path() first looks at the alias table THEN call custom_url_rewrite_inbound. Not sure why this would be.

So for instance custom_url_rewrite_inbound erases from the url community/. So all urls are prefixed by community/. community/node/345 works as drupal_get_normal_path() doesn't find a path alias for that, custom_url_rewrite() removes the community, and bam we have a good url (node/345).

But say the node has an alias blog/scotts-new-post. Then the url in the users browser is community/blog/scotts-new-post. drupal_get_normal_path() doesn't find a path alias for community/blog/scotts-new-post (an alias exists for blog/scotts-new-post). Then custom_url_rewrite is called, removing community/ thus resulting in a 'normal path' called blog/scotts-new-post.

In our custom_url_rewrite function we could drupal_lookup_path('source', $path, $path_language) but that would result in querying alias table twice. The first one is a wasted call.

So the solution drupal_get_normal_path() first calls custom_url_rewrite_inbound then drupal_lookup_path('source', $path, $path_language).

CommentFileSizeAuthor
patch16.patch841 bytesScott Reynolds

Comments

m3avrck’s picture

Bump, still running this patch.

dave reid’s picture

Version: 6.8 » 7.x-dev
Issue tags: +custom_url_rewrite

Would need to be fixed in HEAD first. Also tagging.

Status: Needs review » Needs work

The last submitted patch failed testing.

dave reid’s picture

Status: Needs work » Closed (duplicate)
summit’s picture

Status: Closed (duplicate) » Active

Hi, Sorry, but the latest link is a link to exactly this page, so setting this to active again, ok?
Greetings, Martijn

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.