We are porting a website to drupal. The old site is a custom PHP site that uses "ugly" urls like getPage.php?id=100. In our new site I would like to alias urls like getPage.php?id=100 to point to node/4 so that external links to the old site will continue to work.

There seems to be a problem with the url alias feature. It does not seem to work on aliases that use GET parameters in the url. For instance, if i alias about.php to point to node/3, it works. But i create a url alias that has GET parmeters like getPage.php?id=100 and point to node/3 I see a page not found error.

Is there a way around this?


gpk’s picture

Generally it is best to use path aliases to define a URL that you "want" for a given node or page. Use http://drupal.org/project/path_redirect to map old URLs to new, and http://drupal.org/project/globalredirect to prevent the same content appearing under different URLs.

However in your case it's more complex because I don't think you can include GET parameters in the "from" part of a path redirect, or in a URL alias for that matter.

I'd suggest something like this:
1. create new PHP input format page with alias getPage.php
2. if you have only a few ids then you could use a simple if or switch statement combined with drupal_goto() http://api.drupal.org/api/function/drupal_goto/5 to do the redirect
3. if you have more than a few then you could do something like


from within getPage.php
4. then use path redirect to create the redirects from getPage/id/100 to the new page

Step 3. can also be done in .htaccess, if you know how. This would reduce the number of redirects from 2 to 1.

There are probably other ways, but maybe this will get you started :-)


jsaints’s picture

This suggestion did work for me. I had to do the following:

1) install path_redirect module
2) create a PHP page with a URL alias of getPage.php containing:

if( $_GET['id'] )
drupal_goto("getpage/id/" . $_GET['id']);

3) then for each old URL like getPage.php?id=100 I had to manually create a PATH REDIRECT for example:

getpage/id/100 -> node/23

Note: The the use of Path Redirects... not path aliases for step #3

wikki boy 03’s picture

I am making a site and am facing a strange problem. I have created a template page "page-taxonomy.tpl.php" for some custom formatting and custom coding. I can send you the code of this page if you like.
The main problem that i am having is that, my page outputs the url of particular pages as


however i want to make this user friendly and want to make it appear as


For this i have tried to add url-alias for the above url, it adds successfully... but when i try to access the page from


it gives me "Page Not Found Error". What is the issue behind this? Can somebody advise on how to rectify this?

Impossible is Nothing!

kenorb’s picture