Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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