I replaced the core Drupal search with a custom search created in views using the following rewrite rule in my .htaccess file:
RewriteRule ^search/node/(.*)$ custom-search&searchterms=$1 [NC,L]
The &searchterms= is appended to the new URL so that views knows that what follows are the terms to be used for the search query. The above works perfectly, except for when special characters are entered (such as a double quote), as this causes a forbidden error.
What I would like to do is strip out all characters except for letters, numbers and spaces from the $1 variable in the rewritten search query so that such errors are no longer an issue, and have been unable to do so. Can anyone tell me how this can be done?
Thanks for any help you can provide!