ISAPI_ReWrite redirect when there is a space in url

72 Views Asked by At

I have a URL which contains white space which I am trying to redirect to another URL but some how the URL is not matched

The mapping file looks like

tours/cycle%20tour.htm cycle-tours.html

I have tried many way like

"tours/cycle%20tour.htm" cycle-tours.html
"tours/cycle tour.htm" cycle-tours.html
 tours/cycle\ tour.htm" cycle-tours.html
 tours/cycle\stour.htm" cycle-tours.html

but no chance. Can any one pls help me

1

There are 1 best solutions below

0
Yaroslav On

You will need to encode spaces in the test string back. Use something like this:

RewriteEngine On

RewriteMap map_txt txt:text_map.txt
RewriteMap map_escape int:escape

RewriteCond ${map_txt:${map_escape:$1}|NOT_FOUND} (.*)
RewriteCond %1 !NOT_FOUND 
RewriteRule (.+) %1 [R]