Is it a good idea to fork a sed for each request? The RewriteRule condition will accept any URL path _containing_ /exchange/... and proxy it to what host? There are built-in functions available for RewriteMap, including functions for encoding and decoding URLs. I suggest that you use them instead of the prg: method. RewriteEngine on RewriteMap damnpercent int:escape RewriteRule ^(/exchange/.*)$ http://exchange.server.com/${damnpercent:$1} [P] -ascs -----Original Message----- From: Covington, Chris [mailto:Chris.Covington@xxxxxxxxxxx] Sent: Thursday, September 29, 2005 10:15 PM To: users@xxxxxxxxxxxxxxxx Subject: [users@httpd] % mod_proxy URL issue Is it possible to have a mod_rewrite rule which will rewrite a % with a %25? Below is a hack for Outlook Web Access which, when reverse-proxied, apache2 chokes on when a % is in a subject of an email (and thus in the URL) unless the following is done. Chris Insert this right before your "front-end" Proxy* directives in httpd.conf. # Using mod_rewrite to fix a problem when percent symbols are in # the subject line of the OWA email (the email subject is used # in the web query - WTF?). The entire URI is passed to a small # bash script I wrote that replaces all occurrences of the % symbol # with the URI escape sequence (%25). That seems to make everything # happy. RewriteEngine On RewriteMap damnpercent prg:/usr/local/bin/percent_rewrite RewriteCond $1 ^/exchange/.*\%.*$ RewriteRule (/exchange/.*) ${damnpercent:$1} [P] The simple bash script uses sed to work its magic. You'll notice I am also sending the original and changed URL to a log file in /tmp. This helps with troubleshooting and can be shut off when you're confidant everything is working. (This could easily be rewritten in any language.) #!/bin/bash LOGFILE=/tmp/percent_rewrite.log cat /dev/null > $LOGFILE while read URL do NEWURL=$(echo "$URL" | sed -e "s/%/%25/g") echo "Changing $URL to $NEWURL" >> $LOGFILE echo $NEWURL done --- Chris Covington IT Plus One Health Management 75 Maiden Lane Suite 801 NY, NY 10038 646-312-6269 http://www.plusoneactive.com --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx