1

Ok so i'm trying to come up with some rewrite rules in Iirf.ini and i can't quite get it. I'm looking to check the referrer and then add something to the querystring of url you are hitting

1.so say i came from testing.lc and hit just the domain

domain.com/

2.or the domain with index.cfm

domain.com/index.cfm

3.or the domain with index.cfm and any number of query params

domain.com/index.cfm?key1=value1&key2=value2

4.or the domain with a shorturl

domain.com/login

5.or the domain with a shorturl and any number of query params

    domain.com/login?key1=value1

domain.com/page?key1=value1

So far i have something like this

RewriteCond %{HTTP_REFERER} ^http://testing\.lc/.*$
RewriteRule ^/([^?]+)(\?.*|/){0,1}$ /$1?newkey=newvalue [I,QSA]

Which appears to work on a few urls but not all of those listed above. This rewrite cannot use [L] either as there are other matches after for the urls such as /login that need to pass the querystring.

Any help or advice greatly appreciated...

sAnS
  • 1,169
  • 1
  • 7
  • 10
davidejones
  • 1,869
  • 1
  • 16
  • 18
  • This is quite a difficult job since you have to check first if there is a `?` or not. If it already exists you have to use `&newkey=newvalue`, if it doesn't `?newkey=newvalue` should be added ... – HamZa May 28 '13 at 18:59
  • yea i've been trying to figure that out for a while and i'm not getting anywhere i had something like `RewriteCond %{QUERY_STRING} (^|&)newkey=newvalue(&|$)` but that didn't work – davidejones May 28 '13 at 19:51

0 Answers0