Download & Extend

Unable to redirect paths which only include query string

Project:Path redirect
Version:6.x-1.0-rc2
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I have a multilingual website with drupal 6. path redirect does not redirect path(s) which only include for example "?id=5". i checked the source code and realized that the problem is because of the following code :

<?php
$args
[':path_query'] = $_GET['q'] .'?'. $path['query'];
?>

I removed $_GET['q']. and the problem fixed.
<?php
$args
[':path_query'] = '?'. $path['query'];
?>

I don't understand the usage of $args[':path_query'] = $_GET['q'] . since i don't have any problem after applying this patch.

Comments

#1

You should not be removing $_GET['q']. So make sure I'm understanding correctly. You want to redirect from http://yourdrupalsite.com/?id=5 to another page?

#2

Unfortunately it dos not without removing it. and yes you got it right
From: ?article_id=1
To: fa/node/1027

#3

If you remove the $_GET['q'] and you have that redirect you want set, if I go to http://yoursite.com/please-do-not-redirect-me?article_id=1 it will still redirect me. I have a solution I'm working on that will involve you creating a redirect using From: ?article_id=1

#4

You're right i just tested it.
Sure, let me know if you did any progress.
Thanks

#5

Status:active» fixed

On second thought I'm not sure this is a redirect appropriate for the module since you're operating on an existing path (). This would probably be best implemented in .htaccess. Although we will be adding 'forced redirect' support in #615008: "Forced" path redirect - override the existing path or alias. You will find with the latest commits that you can perform a redirection on '?id=3' now.

#6

Thanks Dave,

#7

Category:bug report» support request

I'm trying to redirect from a previous wordpress site with permalinks set to non-clean like so "blog/?p=123". I have the latest dev release of path_redirect and I've turned off the blog modules, but I just get a page not found 404 when I type in the above url. It sounded like from your comment above that redirects from query stings like this was possible with the latest dev releases? Am I doing something wrong?

Thanks for any insight!

#8

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#9

Version:6.x-1.0-beta4» 6.x-1.0-beta7
Status:closed (fixed)» active

Has this really been fixed? I'm using 6.x-1.0-beta7 but when I try to redirect from

http://example.com/?page_id=1306

to an internal page, the question mark (?) is stripped and the redirect is created as

http://example.com/page_id=1306

This redirect is created, though, but it doesn't work:

http://example.com/test/?page_id=1306

#10

Status:active» fixed

You need to use From: <front>?page_id=1306

#11

Great, thanks!

#12

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#13

Version:6.x-1.0-beta7» 6.x-1.0-rc2

Sorry to open old threads, but is this feature present in RC2? If it is, maybe I'm doing something wrong. Thanks.

#14

Never mind. Not sure what I did or didn't do, but it started working.

nobody click here