Page 1 of 1

URL search with &

Posted: Sat Jan 13, 2018 2:40 am
by RobertoZST
Hello, when in my store someone in the page search do a search of a product and in select also the description it doesn't work because the url is wrong. It is like this: http://www.lilnap.com/cerca?search=maialino&description=true

how can I fix it?

Re: URL search with &

Posted: Sat Jan 13, 2018 10:51 pm
by straightlight
See if this solution resolves the issue: https://stackoverflow.com/questions/348 ... a-htaccess

Re: URL search with &

Posted: Sun Jan 14, 2018 1:43 am
by MrPhil
Even better, find out why the & in the assembled URL is being converted somewhere to a &. and fix it (perhaps an unnecessary or too-late htmlentities() or htmlspecialchars() call? urlencode() might be a better choice). The URL produced should have & in it instead of &, so it's better to fix it at the source than to patch it up in the .htaccess. You certainly can temporarily patch it in .htaccess until you've found the source of the problem and fixed it, but .htaccess is not a good long-term solution.

Re: URL search with &

Posted: Sun Jan 14, 2018 3:15 am
by straightlight
My previous reply on the above is, indeed, to know the different between back and then. Not necessarily as a permanent solution since most of the users still won't know where their reported issues originates from. Otherwise, they wouldn't necessarily need to report it.

Re: URL search with &

Posted: Mon Jan 15, 2018 1:18 am
by MrPhil
Well, naive users might get the impression that the proper permanent fix is to futz it in .htaccess to convert & to &, while real programmers know that this is at best a temporary workaround, and the offending code needs to be fixed. I just wanted to clarify that point. You need to be careful in making statements that can be misunderstood by non-professional developers (e.g., merchants just trying to sell stuff).

Re: URL search with &

Posted: Mon Jan 15, 2018 1:31 am
by straightlight
MrPhil wrote:
Mon Jan 15, 2018 1:18 am
Well, naive users might get the impression that the proper permanent fix is to futz it in .htaccess to convert & to &, while real programmers know that this is at best a temporary workaround, and the offending code needs to be fixed. I just wanted to clarify that point. You need to be careful in making statements that can be misunderstood by non-professional developers (e.g., merchants just trying to sell stuff).
This is what we call: Part of the troubleshooting process.

Re: URL search with &

Posted: Tue Jan 16, 2018 7:58 pm
by RobertoZST
thanks for your support at all. At moment I have add the lines in htaccess, but how can I understand where the issue is?

thanks

Re: URL search with &

Posted: Wed Jan 17, 2018 1:08 am
by MrPhil
So you have the rewrite in .htaccess to temporarily fix incoming & to &? OK, just remember that's only a temporary fix. As to where the problem lies, it's in your PHP code somewhere, probably in an extension or custom code. What OC version are you at, and what extensions are installed? If you want to look for it yourself (which you should at least try to do), it's probably an htmlentities() or htmlspecialchars() call being applied to a built Query String. What it should probably be using is urlencode().

Re: URL search with &

Posted: Wed Jan 17, 2018 2:01 am
by RobertoZST
MrPhil wrote:
Wed Jan 17, 2018 1:08 am
So you have the rewrite in .htaccess to temporarily fix incoming & to &? OK, just remember that's only a temporary fix. As to where the problem lies, it's in your PHP code somewhere, probably in an extension or custom code. What OC version are you at, and what extensions are installed? If you want to look for it yourself (which you should at least try to do), it's probably an htmlentities() or htmlspecialchars() call being applied to a built Query String. What it should probably be using is urlencode().
Yes I undestand it is only a temporary fix, but really I don't know how fix the issue.I will check at first the extensions.

Thank you