Closed (fixed)
Project:
Custom Search
Version:
6.x-1.7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Mar 2011 at 16:18 UTC
Updated:
7 Apr 2011 at 08:32 UTC
On my site search function was totally broken after upgrade to 6-1.7 (it was OK with 6-1.6).
The redirection urls generated by custom search were wrong and looked like "http://mysite.com/http://mysite.com/search/node/bla-bla-bla", so site address was added twice.
I found the cause in line 386 of custom_search.module:
$base_redirect = 'http' . ((isset($_SERVER['HTTPS']) || $_SERVER['SERVER_PORT'] == 443) ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . url();
For my setup, this problem was fixed by changing url() to base_path(). So the line above now looks as follows:
$base_redirect = 'http' . ((isset($_SERVER['HTTPS']) || $_SERVER['SERVER_PORT'] == 443) ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . base_path();
Comments
Comment #1
jdanthinne commentedUnfortunately, base_path doesn't include the language in multilingual sites.
I've made some research and came up with something simpler I think.
Can you try with:
Comment #2
gleich commentedIt won't work for me, cause my site is multilanguage and I use domain prefixes for language variants (i.e. en.mysite,com).
I wonder if there could be a solution that covers all multilanguage setups?
Comment #3
jdanthinne commentedWhat is the generated url when using #1?
Comment #4
gleich commentedHm, sorry, #1 seems to be OK as well, though I get an extra slash like this:
http://ru.saveoldkyiv.org//search/node/hh
Comment #5
jdanthinne commentedWhat if you add this line just after:
Comment #6
gleich commented#5 has no effect (when placed just after line mentioned in #1).
But the next line which is already there seems to cause the problem:
If I comment it out, I get only one slash. But this line looks quite normal.
Weird...
Comment #7
jdanthinne commentedOh, I had removed this line in fact in my tests, forgot to tell you (and you can download the latest DEV version, the line was removed).
So #1 should be finally ok with the line (#6) removed? Download latest DEV and confirm please.
Comment #8
gleich commentedYes, with latest DEV all works as it should.
Thanks for the prompt responses!
Comment #9
jdanthinne commentedComment #10
jon nunan commentedNot sure if this is the right place, but the 7 dev seems broken if you aren't using locale prefixes. Instead of
http://{BASE}/search/node/{SEARCH STRING}
I get
http://{BASE}/en/search/node/{SEARCH STRING}
which will give me a 404.
Looking at the code I see
I think you should be using 'prefix' here, as the language is set even when you're not using the path prefix. So something more like:
Comment #11
jdanthinne commented@meatstack: thanks, pushed the changes to DEV version.