Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help needed to differentiate sessions

mod_rewrite is matching EVERYTHING that matches its rules, not just some.

         

sinaowolabi

5:18 pm on Nov 5, 2014 (gmt 0)

10+ Year Member



Hi!

Please I need some assistance with mod_rewrite, which works a little TOO well Smile

I am trying to capture 3-4 digits when sent as part of a URL, for them to be proxied to another URL. I have no control over how the source sends this data, I am supposed to redirect it. Which works.

#RewriteCond %{HTTP:whoisd-ussd-message} ([\d]{2,4})
#RewriteRule ^/original/individual.do(.*)$ [other.example.com...] [P]

The problem is this works for all URLs that have digits to this server.
I am expecting to trap URLs that send digits as part of the first call to the server, but this also affects URL calls that are part of other server call transactions, once digits appear, it gets redirected.
Please what can I do to stop this interference?

Thanks!

[edited by: Ocean10000 at 6:01 pm (utc) on Nov 5, 2014]
[edit reason] examplfied [/edit]

sinaowolabi

9:14 am on Nov 11, 2014 (gmt 0)

10+ Year Member



Fixed it:

RewriteCond %{HTTP:whoisd-ussd-message} ^\d{3,4}$
#do not honor if string is found
RewriteCond %{QUERY_STRING} !string= [NC]
RewriteRule ^/original/individual.do(.*)$ [some.other...] [L,P]

lucy24

7:00 pm on Nov 11, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Memo to self: Make a habit of ignoring new questions on purpose (as opposed to overlooking them by accident). There's nothing like the feeling of satisfaction that comes from figuring something out for yourself ;)

sinaowolabi

7:24 am on Nov 13, 2014 (gmt 0)

10+ Year Member



Eh...not sure I follow you. I was just trying to be helpful.

lucy24

9:55 am on Nov 13, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, and you helped yourself without anyone else's assistance :)

sinaowolabi

6:39 am on Nov 21, 2014 (gmt 0)

10+ Year Member



I got lucky I guess.