its funny, I wrote exactly the same module two days ago.
I think you should use drupal_get_path_alias, because if you use drupal_lookup_path directly it is not possible to define a custom_url_rewrite-function
here comes a patch which replaces it
beside this the check for function_exists('drupal_lookup_path') is not necessary because it exists in every drupal 4.7 and drupal 5.
---
I want to point you over to a patch for drupal core I wrote which sets the alias of your frontpages' path to ''.
example:
print 'Alias of frontpage='. drupal_lookup_path('alias', variable_get('site_frontpage','node'));
// Output:
// currently:
// Alias of frontpage=node
// after this patch:
// Alias of frontpage=
url() does not recognize if $path == frontpage
I think this may be interesting in this context
| Comment | File | Size | Author |
|---|---|---|---|
| globalredirect.patch.txt | 943 bytes | Tobias Maier |
Comments
Comment #1
nicholasthompsonInteresting... You address few points here.
Comment #2
Tobias Maier commentedempty()is slow in general.drupal_lookup_path()returns FALSE if it does not find a proper alias. so why not check for this? (beside thisempty(0)returns true, too which is not right in our usecase)later on if we swich to drupal_get_path_alias() we have to compare
if ($_REQUEST['q']==drupal_get_path_alias($_REQUEST['q'])) {}Comment #3
nicholasthompsonI just learned something :-)
That bit is very necessary as without it, pages dont load! I think the function may get called twice - the first time seems to be before anything has loaded, such as the ability to lookup paths.
Apart from that, the Sportbusiness.com site seems to be running fine with the other changes such as the !== comparision.
I'll have a read of the mass URL aliasing document tomorrow - I like the sound of that. It might solve the issue with us having 25,000 aliases for news items! Alternatively, it might just allow the possibility for multiple urls to server the same page.
Comment #4
nicholasthompsonfixed in version 1.3...
It now…
Cheers for pointing those out.
Comment #5
(not verified) commented