Replace WWW in URL

I would like to automatically replace the "www" for all Amazon URLs with "smile" in Chrome

Amazon will ONLY make a contribution to the non-profit organization associated with your Amazon account when purchases are made from a SMILE URL.

For example, instead of using this standard WWW URL:

I would need to purchase the product from its SMILE URL:

I require assistance executing this logic in Keyboard Maestro:

If %ChromeURL% contains
Set variable (amazonURL) with %ChromeURL%
Modify amazonURL ("replace" www with "smile")
Replace %ChromeURL% with amazonURL

You've pretty much got it.


Some changes I made:

  1. Use a Local Variables instead of a global since you don't need the variable later.
  2. Search for "www." to make sure we are getting the "www" that we want.


Many Thanks - works like a charm

I merely made a small change - instead of searching for and replacing "www." I used "" instead — Was there a reason why you did not include the domain to make the queries more specific?

No reason. Your solution is better.

1 Like

Iron - Sharpens - Iron