From 94f6e94ffdb72e0ac78c5d06ec95a9e6f9f6f47f Mon Sep 17 00:00:00 2001
From: Dries Buytaert A very powerful feature of Drupal is the ability to have control over all paths. The path module is the tool that provides this functionality and is part of the basic Drupal installation, although it is not enabled by default. Some examples of re-mapping paths are:Background
user/login => login\n\nimage/tid/16 => store\n\ntaxonomy/page/or/7,19,20,21 => store/products/whirlygigs\n\nnode/view/3 => contact
This functionality integrates seamlessly into node forms and also provides the administrator an interface to view all aliases that have been created.
Aliases have a 1 to 1 relationship with their original Drupal URLs. In other words you cannot have an alias map to more than one path. Likewise, a Drupal URL can't be mapped to more than one alias.
"; - $output .= "Two new permissions are introduced for aliasing URLs: create url aliases and administer url aliases.
A very powerful feature of Drupal is the ability to have control over all paths. The path module is the tool that provides this functionality and is part of the basic Drupal installation, although it is not enabled by default. Some examples of re-mapping paths are:
++user/login => login + +image/tid/16 => store + +taxonomy/page/or/7,19,20,21 => store/products/whirlygigs + +node/view/3 => contact ++
This functionality integrates seamlessly into node forms and also provides the administrator an interface to view all aliases that have been created.
+Aliases have a 1 to 1 relationship with their original Drupal URLs. In other words you cannot have an alias map to more than one path. Likewise, a Drupal URL can't be mapped to more than one alias.
+ +Two permissions are related to URL aliasing: create url aliases and administer url aliases.
+Drupal also comes with user defined mass URL aliasing capabilities. You might like to see completely different URLs used by Drupal, or even URLs translated to the visitors' native language, in which case this feature is handy. Only an administrator with access to the website source code can set up this kind of aliases. You can define a conf_url_rewrite
function in conf.php, following this example:
+function conf_url_rewrite(\$path, \$mode = 'incoming') { + if (\$mode == 'incoming') { // URL coming from a client + return preg_replace('!^display/(\d+)$!', 'node/view/\1', \$path); + } + else { // URL going out to a client + return preg_replace('!^node/view/(\d+)$!', 'display/\1', \$path); + } +} ++
This function will shorten every node/view/\$node_id
type of URL to display/\$node_id
. Individual URL aliases defined on the browser interface of Drupal take precedence, so if you have the 'contact' page alias from the example above, then the display/3
alias will not be effective when outgoing links are created. Incoming URLs however always work with the mass URL aliased variant. Only the 'incoming' and 'outgoing' modes are supposed to be supported by your conf_url_rewrite
function.
You cannot only use this feature to shorten the URLs, or to translate them to you own language, but also to add completely new subURLs to an already existing module's URL space, or to compose a bunch of existing stuff together to a common URL space. You can create a news
section for example aliasing nodes and taxonomy overview pages falling under a 'news' vocabulary, thus having news/15
and news/sections/3
instead of node/view/15
and taxonomy/view/or/3
.