Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need some help with the following RewriteRule:

RewriteRule ^/iesearch/(.*)$ /jsp/search/ieaccelerators/visualsearch.jsp?q=$1 [L,PT]

The intention is to rewrite search-queries from http://mydomain/iesearch/alvin+the+chip to a JSP. This works fine as long as the URL does not contain encoded characters such as: http://mydomain/iesearch/alvin+%26+the+chip.

The rewrite log shows the following: (2) init rewrite engine with requested uri /iesearch/alvin+&+the+chip

(2) rewrite '/iesearch/alvin+the+&+chip' -> '/jsp/search/ieaccelerators/visualsearch.jsp?q=alvin+&+the+chip'

(3) split uri=/jsp/search/ieaccelerators/visualsearch.jsp?q=alvin+&+the+chip -> uri=/jsp/search/ieaccelerators/visualsearch.jsp, args=q=alvin+&+the+chip

I would have hoped that the %26 is passed on instead of the &.

share|improve this question

The [B] flag should force the query string to be escaped, i.e.

RewriteRule ^/iesearch/(.*)$ /jsp/search/ieaccelerators/visualsearch.jsp?q=$1 [L,PT,B] 
share|improve this answer

I managed to get this sorted like so:

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /iesearch/([^\ ]*)\ HTTP/ RewriteRule ^/iesearch/ /jsp/search/ieaccelerators/visualsearch.jsp?q=%1 [NE,PT,L]

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.