Apache mod_rewrite replace characters in REQUEST_URI

Posted by frio80 on Stack Overflow See other posts from Stack Overflow or by frio80
Published on 2010-04-26T17:49:32Z Indexed on 2010/05/02 14:17 UTC
Read the original article Hit count: 139

Filed under:
|

I'm trying to write some .htaccess rules that replace certain characters in the REQUEST_URI parameter. Specifically, I want to replace the following:

  • "<" = &lt;
  • ">" = &gt;
  • "'" = &apos;
  • '"' = &#x22;
  • ")" = &#x29;
  • "(" = &#x28;

Example URL could be http://www.example.com/?<script>alert(1)</script>&q=")("<script')

I've tried a whole bunch of methods with no success. Can someone point me in the right direction? Thanks.

© Stack Overflow or respective owner

Related posts about apache

Related posts about mod-rewrite