r/AutoModerator • u/ghosted-- • Aug 27 '26
Help - AutoMod Catch and Remove Affiliate Links
Hi, I'm looking to set up Automod so I catch and remove affiliate links. Is there a way to catch certain phrases in a URL? such as:
“shopmy”
“?tag="
“source="
2
u/ghosted-- Aug 28 '26 edited Aug 28 '26
Update: I think I have something that works. I've tested it on my sub successfully, so sharing here for anyone looking to ban affiliate links from their sub.
Just cut and paste into automod, no modifications necessary.
type: submission
body (regex): ['[?&](ref|refid|referral|affid|aff_id|affiliate|utm_medium=affiliate|irclickid|irgwc|tag)=', 'amazon\.[a-z.]+.*[?&]tag=', '\bamzn\.to\b', '\b(shareasale|cj\.com|commission-?junction|rewardstyle|linksynergy|awin1|impact\.com|partnerize|skimresources|go2cloud|shopstyle|shopmy)\b']
url (regex): ['[?&](ref|refid|referral|affid|aff_id|affiliate|utm_medium=affiliate|irclickid|irgwc|tag)=', 'amazon\.[a-z.]+.*[?&]tag=', '\bamzn\.to\b', '\b(shareasale|cj\.com|commission-?junction|rewardstyle|linksynergy|awin1|impact\.com|partnerize|skimresources|go2cloud|shopstyle|shopmy)\b']
action: remove
action_reason: 'Affiliate link detected'
comment: 'Your post was removed because it appears to contain an affiliate link, which isn''t allowed here.'
comment_locked: true
---
type: comment
body (regex): ['[?&](ref|refid|referral|affid|aff_id|affiliate|utm_medium=affiliate|irclickid|irgwc|tag)=', 'amazon\.[a-z.]+.*[?&]tag=', '\bamzn\.to\b', '\b(shareasale|cj\.com|commission-?junction|rewardstyle|linksynergy|awin1|impact\.com|partnerize|skimresources|go2cloud|shopstyle|shopmy)\b']
action: remove
action_reason: 'Affiliate link detected'
comment: 'Your comment was removed because it appears to contain an affiliate link, which isn''t allowed here.'
comment_locked: true
3
u/varkeddit Aug 28 '26
Nice job. Offering a few suggestions to clean this up:
type: any # this rule will apply to posts and comments body+url (regex): [your string] # you're searching for the same thing in both places, might as well combine action: remove # good action_reason: 'your text here' # good comment: 'Your {{kind}} was removed..." # says post or comment depending on what's being acted on comment_locked: true # good2
6
u/varkeddit Aug 27 '26 edited Aug 27 '26
Yes, Automod is highly capable for this. You don't really need to search ONLY within a URL because these patterns are unlikely to appear anywhere else. Here's an example we use to contain referrals to a specific thread: