Closed (duplicate)
Project:
Global Redirect
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Oct 2008 at 16:24 UTC
Updated:
23 Sep 2009 at 21:23 UTC
Jump to comment: Most recent file
Comments
Comment #1
checker commentedYou can solute this problem with following code - better ideas are welcome!
before:
add:
Comment #2
nicholasthompsonSurely we'd need to apply the custom_url_rewrite_inbound to $_REQUEST['q'] at the very beginning so it effects all the redirects (frontpage, '/0' trimming, etc).
Also - is this problem due to not using custom_url_rewrite_inbound OR is it relating to outbound (as the subject suggests)?
Any thoughts?
Comment #3
checker commentedThe subject is wrong. It should be mean "Problems with custom_url_rewrite_inbound". I think there are many situations that need both functions in the interplay use. But the problem with global redirect is just to find in custom_url_rewrite_inbound().
-I used this code above for a productiv website and there are no problems.
-I used custom_url_rewrite_inbound() in settings.php.
Comment #4
Scott Reynolds commentedI have a better patch here. And it is a severe problem. First here are my rewrite functions
Basically, what they do is rewrite the user/ID/* urls to user/NAME/*. This in conjunction with global redirect makes user/NAME/* redirect forever.
Why this happens
drupal_get_path_alias() returns either an alias url (from the url_alias table) or the drupal_normal_path (user/1/*). Global redirect assumes that if the $alias (which is from drupal_get_path_alias()) doesn't match the $_REQUEST['q'] then we need to redirect. The problem with that is an aliased path can come from the url_alias table, and it can come from custom_url_rewrite_* (which drupal_get_path_alias() ignores). So the $_REQUEST['q'] = user/scott but $request = user/1 and alias = user/1.
Thus this simple patch.
Comment #5
Scott Reynolds commentedplz review
Comment #6
smoothify commentedpatch in #4 works great for me - thanks Scott :)
Comment #7
Scott Reynolds commentedif looking for ways to test this patch try drupal.org/project/spaces
That too will make globalredirect cry out in pain :-D, this patch should fix that.
Comment #8
smoothify commentedIt fixed my use case which was just a simple menu item path rewrite, where it would get stuck in a loop.
I think this will also fix the issue when using this module with the subdomain module. Will be testing that later this week.
Thanks again
Ben
Comment #9
smoothify commentedAfter testing, this patch doesn't fix the issue with subdomain module after all - that needs some further changes to work.
Comment #10
Scott Reynolds commentedDOH! this breaks the de-slashing.
Comment #11
Scott Reynolds commentedHere is a naive fix.
Comment #12
Scott Reynolds commentedOk so this is a real fix :-D
Basic idea is we need to find the 'alias'. And it can exists in two spots, the url_alias table or via custom_url_rewrite_* functions.
I like this patch so much better, its clean.
Comment #13
Scott Reynolds commented#346911: Redirect Loop and custom_url_rewrite ignored