[drupal-devel] [feature] Path aliases - controlling outgoing alias

moshe weitzman drupal-devel at drupal.org
Thu Jun 9 04:41:09 UTC 2005


Issue status update for http://drupal.org/node/24321

 Project:      Drupal
 Version:      cvs
 Component:    path.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  mikeryan
 Updated by:   moshe weitzman
 Status:       patch

looks like a small, useful patch to me.




moshe weitzman



Previous comments:
------------------------------------------------------------------------

June 4, 2005 - 20:44 : mikeryan

Attachment: http://drupal.org/files/issues/alias_0.patch (6.63 KB)

Here's a patch to implement 2/3 of my previous suggestions [1]. 


1. A *status* column is added to the url_alias table. A 0 (zero) value
indicates an alias explicitly created by a user or administrator; a 1
(one) value indicates an alias created by an automated process. No core
code support is required here - aliases created by core methods (the
node form or url aliases settings) will default to 0. The pathauto
module (or any other module that wishes to automatically generate
aliases) will create them with a status of 1, and when updating aliases
will only delete/modify aliases with a status of 1, so that aliases
created explicitly by users are not blown away.


2. A *weight* column is added to the url_alias table. As path aliasing
exists now, multiple aliases may be created for a given path but there
is no control over which one is generated in the outgoing direction (as
in listings). This patch adds the support for editing weights for
aliases to the url aliases settings (and both *status* and *weight*
become optional arguments to path_set_alias()), and
drupal_lookup_path() is modified to pick the lowest weighted alias in
response to an 'alias' call (if there's a tie for lowest weight, it's
the same result as before, which is most likely lowest pid === first
created).


I really wanted to implement a method for having aliases that produce a
301 (Move Permanently) response, particularly if you want to change the
alias for a page without abandoning any bookmarks/search engine links
that are already out there - but I started on it and realized it will
require more thought to integrate cleanly... It might just be easier to
do that using conf_url_rewrite()...


Thanks for your consideration...
[1] http://drupal.org/node/22352




------------------------------------------------------------------------

June 4, 2005 - 23:48 : ramdak5000

Can I apply this to pathauto-4.5?


Thanks.




------------------------------------------------------------------------

June 5, 2005 - 11:00 : mikeryan

This is a proposed patch to core - if accepted, I wouldn't expect it to
be available before Drupal 4.7. It's unlikely this patch would apply to
Drupal 4.5 (although the path.module patch may very well work, and the
small change to bootstrap.inc could easily be done manually). 


I will release a version of pathauto taking advantage of these changes
only after they're accepted and committed to cvs.







More information about the drupal-devel mailing list