Jump to:
| Project: | Path redirect |
| Version: | 6.x-1.0-beta6 |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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!
Comments
#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.
#3
I can't set a path to have a ? (question mark) at the beginning... therefore when I try to make a link work from a Joomla site to my new site, it simply goes to the front page.
For instance, the path on the old site was:
http://www.example.org/index.php?option=com_adon&task=category&cat_id=7&...
On the new site, the link is:
https://example.org/giving/online#parishes
However, if I enter in everything after 'index.php', then the ? is truncated when I save the URL redirect, and the link won't redirect. If I enter everything including the index.php, then it still 'redirects' to the front page.
#4
Updating version.
#5
@geerlingugy: Use
<front>?id=foobar#6
Ah, perfect! Thank you, Dave!
#7
Automatically closed -- issue fixed for 2 weeks with no activity.