I’ve spent the last week tinkering with and issue in an EE2.1.4 site on a Dreamhost server. The *entire* site was working perfectly, except for URLs that contained query strings. Affected pages displayed as white with the phrase “The URI you submitted has disallowed characters.” displayed on the screen. Here’s an example URL: http://site.com/?ACT=20
These pages are few and far between, but they usually do important things (like log the user out, or redirect the user from PayPal after a purchase). I surmised that one of the rules in my .htaccess file was the cause of the problem, but I wasn’t sure. Some things that I’ve tried in the spirit of experimentation:
I’ve been using ‘REQUEST_URI’ as my URI Protocol, but I just tried other settings (PATH_INFO, QUERY_STRING, AUTO) and none of them fixed the issue. I tried adding “?” and “=” to the list of characters allowed in the URL (and yes, I escaped the “?”). This setting is in EE’s config.php file. No dice. Also in config.php, I tried enabling support for query strings. Again, no dice.
I disabled nearly all my conditions/rules below to simplify the debugging process. Still broken. Then I deleted my .htaccess file and the issue still persisted. I poked around with a friend and found that the root of the problem lies in ‘/system/expressionengine/core/EE_URI.php’ on line 202. It reads:
if (preg_match("#(;|\?|{|}|<|>|http:\/\/|https:\/\/|\w+:/*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $str))Changing the line to the following made URLs with query strings work perfectly, as well as the rest of the pages on the site:
if (preg_match("#(;|{|}|<|>|http:\/\/|https:\/\/|\w+:/*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $str))I’m very much against editing core files — especially when I’m unsure of the repercussions. I’ve been struggling with this issue for a week and I’m at my wit’s end. Can anyone explain why “?” characters are manually stripped out of this file, and what problems could arise from my edit of line 202? Can you think of any ways around editing core files? I purchased my first EngineHosting account today (Eeeee! Exciting!) and am prepared to move the site if necessary.
Thanks!