I have a website with a search box on it. The search term is passed to the search page as part of the $_GET (I'm using PHP, but I think that's irrelevant to the problem I'm having), so my final url would be something like www.example.com/search.php?searchterm=smith. However, I'm finding that if an apostrophe is included in the search term (e.g. www.example.com/search.php?searchterm=o'hagen) the server is returning a 406 error. I thought I may be able to catch this in the htaccess file and rewrite it something usable but I haven't been able to so far. I've tried these so far:
RewriteRule ^([^/]*)'([^/]*)$ $1\'$2 [N,E=redirect:1]
RewriteRule ^([^/]*)'([^/]*)$ $1%27$2 [N,E=redirect:1]
Neither of these did me any good. Can anyone suggest what I can use instead?
EDIT: For the moment I've gone with changing the search form to POST and handling this in code but I'm still curious as to how I can get apache to accept the search term in a GET query string.