Replace Rule allows users to replace a string (or matching pattern) with another string in the URL.
- Source Condition: Source condition is where you set criteria for the rules. You can use
URL
,Host
, orPath
withRegex
,Contains
,Wildcard
, orEquals
to match the source request. Learn more about source conditions here.
- Destination URL: The destination to which the users will be redirected based on the source condition.
- Source Filters: You can define better targeting conditions and restrict rules to be applied on specific web pages (or domains), request types, request methods, or request payloads. Learn more about source filters here.
Popular use cases
- Switch Domains: To test your app with the new changes done on the local server, you can use replace
my-app-server.com
withlocalhost:4000
using Replace Rule. By this way, you can test your app without having to change any of your code.
- Change Query Parameter Values: You can change the values of query parameters present in a URL. For example: Changing
?dl-0
to?dl=1
in a dropbox URL downloads the file directly without going to the usual preview page.
- Fix broken/updated URLs: There might be situations where you might be using links to some documentation or blog posts that have been changed/updated, however, you don't want to change the URLs in your code. In such cases, you can use replace rule to redirect the old resource to new one.