You can constantly redirect all matching URLs that have a trailing %20 to the same URL without a trailing %20 using the following rule:
If you are using UrlDecoding Off in your iirf.ini , use:
RedirectRule (.*)%20$ $1 [R=301]
Otherwise, IIRF will automatically decrypt the URL for you before trying to apply the rules. Therefore you can use:
RedirectRule (.*)\s$ $1 [R=301]
To verify this using testdriver.exe :
- Place 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 like
%iirfpath%\testdriver.exe -d .
Please note: testdriver does not decode URLs.
You should get a result similar to the following (I deleted several lines of line feed):
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
source share