Unable to redirect old site's "index.php?id=xxxx" paths
| Project: | Path redirect |
| Version: | 6.x-1.0-beta4 |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Greetings,
In migrating an old non-Drupal site to Drupal, there were only a handful of paths to redirect. They are all of the form "http://sitename.com/index.php?id=xxxx". For each path I created a Path Redirect entry. However none appeared to work.
After poking around, it appeared to me that somewhere along the way, the "index.php" portion of the path to check for redirects was being replaced by the new site's front page default (set using /admin/settings/site-information). So by the time path_redirect_load($where, $args, $sort); is called on line 186, the path it's going to search for looks like "front-page-default?id=xxxx" instead of "index.php?id=xxxx", and therefore no redirect will be matched. The front page default is a Views alias, if that helps.
My hack to make it work in the 6.x-1.0-beta4 module is changing $_GET['q'] on lines 168 and 169 of path_redirect.module to $path['path']. So, I was able to get far enough to make it work for what I need. I absolutely know this change would probably break other redirects but in this particular situation the only paths I needed to redirect have the index.php form shown above. Perhaps another workaround that requires no code change would have been entering my redirect paths with "index.php" already replaced with the front-page-default, but that doesn't seem ideal either...
I suspect this issue could either use a proper fix, or it is a case of my not knowing a more appropriate way to use Path Redirect for this particular situation.
Thank you for the module!

#1
Since Drupal uses index.php as well, you should be creating these redirects from source paths like '?id=xxx' and not be including the 'index.php' part.
#2
Automatically closed -- issue fixed for 2 weeks with no activity.