I have tried extensively to get this working on 6.x..
I am trying to redirect from http://www.ritmocaliente.org/?q=home to http://www.ritmocaliente.org/index.aspx and nothing happens. I also tried to redirect from a non existent page, ?q=nah, and this doesnt work. I tried formatting the to URL is several ways and none worked. Is this an issue with the 6.x version?

CommentFileSizeAuthor
#3 path_redirect-6.x-1.x_iis_3.patch1.32 KBHorsePunchKid

Comments

HorsePunchKid’s picture

I have tested extensively, but not on IIS, which it looks like you're using. There are differences between IIS and Apache in how they define certain CGI variables that Path Redirect needs, and this could very well be related.

This is probably the key:

   $path = substr(request_uri(), strlen($GLOBALS['base_path']));
  if (preg_match('/^\?q=/', $path)) {
    $path = preg_replace(array('/^\?q=/', '/&/'), array('', '?'), $path, 1);
  } 

If you could tell me what request_uri() is returning there, as well as what $path ends up being, it might help. It's going to be very difficult for me to test in IIS, though.

anonimicer’s picture

Yes, I am using IIS. So here is some debug info that hopefully will help:

request_uri()=index.php?q=home
$path=/index.php?q=home

Thanks for your help!

HorsePunchKid’s picture

Category: support » bug
Status: Active » Needs review
StatusFileSize
new1.32 KB

Could you try this patch? I was able to reproduce the problem: If you've got /index.php?q=... in your URL rather than just /?q=..., the regex fails to match. I tested this patch minimally, and it appears to help, at least on Apache.

If this does the trick, it probably needs to get backported to 5.x.

anonimicer’s picture

Hey there

This seems to have made the trick, it is partially working. However, when the page to be redirected from is the home page, no redirect takes place, probably because the url does not contain "?q=home". Also, I was trying to redirect to the index.aspx file, but it always redirected to ?q=index.aspx, except when I put the complete http address. The problem is that I would like this to be domain independent.

Thanks for your help!

greggles’s picture

Title: Not working? » Redirect Support for IIS
Category: bug » feature

Slightly improved title.

Also, this seems like a feature to me.

isaac.niebeling’s picture

Patch worked for me in Drupal 5 --- Not sure about the implication of #4, though.

Isaac