How to implement "Does not Contain" or Negative Filter in Requestly

1

I am using Requestly Chrome & Firefox extension to setup Redirects. I have a use case in which I want to switch the host from say - www.a.com to www.b.com except when www.a.com has a specific path (e.g. www.a.com/do_not_switch)

I know Requestly supports Regex and WildCard matches but I do not see an option to provide a negative filter - something like Does not Contain.

Need help in achieving this use case. Here's the example

Redirect https://gsd.zgjx.zwa.com/* --> https://asc.zxc.com/*

except https://gsd.zgjx.zwa.com/gsd/translation/...

PS: Posting this question on behalf of a user as the solution to this problem is generic and will be applicable/helpful to other users in future

sachinjain024

Posted 2019-08-20T10:40:26.643

Reputation: 333

Answers

1

Requestly does not support negative filter (e.g. Does Not Contain) but you can use a simple trick to solve this use case.

Summary

I have solved and created the rule for you. Please follow these steps

  1. Install Requestly
  2. Open https://app.requestly.in/rules/#sharedList/1566298072114-Negative-Filter-example-support-request
  3. Click Import List button on top right

Details

Step 1 - Change hostname to something else when URL matches your exception condition

URL Matches (WildCard) https://gsd.zgjx.zwa.com/gsd/translation/*
Destination https://www.dummyhost.com/gsd/translation/$1

Step 2 - Define a generic pair to setup Redirection

In the next pair, add the Redirection Logic generically for all the paths. Please note that it won't apply to your exception path because the hostname has already been changed in the first pair.

URL Matches (WildCard) https://gsd.zgjx.zwa.com/*
Destination https://asc.zxc.com/$1

Step 3 - Revert the dummy hostname to the original

URL Matches (Wildcard) https://www.dummyhost.com/gsd/translation/*
https://gsd.zgjx.zwa.com/gsd/translation/$1

Here's a screenshot to help you with the visual

enter image description here

Let me know if it doesn't work for you.

sachinjain024

Posted 2019-08-20T10:40:26.643

Reputation: 333