I am using iirf on IIS6 on a Windows 2003 server. We have the following code to present clean urls and to remove any query strings:
RewriteRule ^/(.+)\?(.+)&(.+)\.(htm)$ /$1
RewriteRule ^/(.+)\?(.+)$ http://betatest.bracknell-forest.gov.uk/$1 [R=301]
# Redirect to ASP if it exists.
# e.g. example.com/foo will display the contents of example.com/foo.asp
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.asp -f
RewriteRule ^(.+)$ $1.asp [L,QSA]
RedirectRule ^/(.+)\.(asp)$ http://betatest.bracknell-forest.gov.uk/$1 [R=301]
# Any bare URL will get rewritten to a URL with .htm appended
RewriteRule ^/([\w]+)$ /$1.htm [I,L]
RedirectRule ^/(.+)\.(htm)$ http://betatest.bracknell-forest.gov.uk/$1 [R=301]
The problem is that since I have added
RewriteRule ^/(.+)\?(.+)&(.+).(htm)$ /$1
RewriteRule ^/(.+)\?(.+)$ http://betatest.bracknell-forest.gov.uk/$1 [R=301]
All query string parameters are removed where we actually need them for(sorry - urls not available externally): betatest.bracknell-forest.gov.uk/news.asp?page=2 In fact the only query string condition we want to to strip the parametrs for is if it contains the Facebook parameter fb_action_ids=52352315213 e.g. betatest.bracknell-forest.gov.uk/help?fb_action_ids=372043216205703&fb_action_types=og.likes&fb_source=aggregation&fb_aggregation_id=288381481237582 I have tried using:
RewriteCond %{QUERY_STRING} ^ fb_action_ids=(.)$ [I]
before the first pair of rules but but it does not appear to do anything.
Just managed to resolve it and boy it feels like a burden off my shoulders: