By Mr Maggoo on
How do I create more than one mass url alias? I have allready set admin to staff with this code:
function conf_url_rewrite($path, $mode = 'incoming') {
if ($mode == 'incoming') { // URL coming from a client
return preg_replace('!^staff!', 'admin', $path);
}
else { // URL going out to a client
$aliased = preg_replace('!^admin!', 'staff', $path);
if ($aliased != $path) { return $aliased; }
}
}
But I wan't to change all 'node/view' bits to just 'view'
How would I do this?
Thanks
Comments
This maybe?
$aliased = preg_replace('!^node/view/(\d+)$!', 'view/\1', $path);
Kind of.
That only works for replacing the url displayed to the client. But it doesn't work for when the client enters the url into their browser
There is a rule in .htaccess
In .htaccess there is a rule:
# Rewrite old-style URLS (pre Drupal 4.5) of the form 'node/view/id':
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^node/view/([^&]+)$
RewriteRule index.php index.php?q=node/%1 [L,R=permanent]
which should work if changed to:
# Rewrite old-style URLS (pre Drupal 4.5) of the form 'node/view/id':
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^view/([^&]+)$
RewriteRule index.php index.php?q=node/%1 [L,R=permanent]
mass url alias problem
I experience a problem with the above rewrite. When i replace node by display according to the manual, the admin pages, including the menu just stop working.
Anyone else had a problem with this, and solved it on an easy way?
Thanks