You may permanently redirect all concerned urls having a trailing %20
to the same url without the trailing %20
by using the following rule:
If you use UrlDecoding Off
in your iirf.ini
, use:
RedirectRule (.*)%20$ $1 [R=301]
Otherwise, IIRF automatically decodes the URL for you before trying to apply the rules. You can therefore use:
RedirectRule (.*)\s$ $1 [R=301]
In order to test this using testdriver.exe
:
- Put the above rule in a file called
iirf.ini
.
Create a file called SampleUrls.txt
containing some test URLs, for example:
/ NO REWRITE
/%20 REDIRECT 301 /
/article NO REWRITE
/article%20 REDIRECT 301 /article
- Call testdriver with a command similar to
%iirfpath%\testdriver.exe -d .
Please note: testdriver does not decode URLs.
You should get an output similar to the following (I removed some newlines):
TestDriver: linked with 'Ionic ISAPI Rewriting Filter (IIRF) 2.1.1.28 x64 RELEASE'.
TestDriver: The IIRF library was built on 'Aug 8 2011 02:26:29'
Processing URLs...(.\SampleUrls.txt)
***
Retrieving server variable that is not supported by TestDriver (SCRIPT_NAME)
NO REWRITE '/' ==> --
OK
***
Retrieving server variable that is not supported by TestDriver (SCRIPT_NAME)
REDIRECT 301 '/%20' ==> '/'
OK
***
Retrieving server variable that is not supported by TestDriver (SCRIPT_NAME)
NO REWRITE '/article' ==> --
OK
***
Retrieving server variable that is not supported by TestDriver (SCRIPT_NAME)
REDIRECT 301 '/article%20' ==> '/article'
OK
0 Errors in 4 Total Trials