To cloak affiliate links in WordPress, install a link management plugin like LegendLinks, create a new cloaked link with your destination URL, customize the slug, and publish. The entire process takes under 5 minutes and requires no coding knowledge.
Link cloaking replaces long, ugly affiliate URLs like https://merchant.com/?ref=abc123&tracking=xyz with clean, branded links like yourdomain.com/recommends/product-name. This protects your commissions from being stolen, makes your links look trustworthy, and gives you full control over your affiliate URLs.
What You'll Need
Prerequisites
A WordPress website
Self-hosted WordPress (WordPress.org), version 5.0 or higher
An affiliate link management plugin (LegendLinks recommended — free)
LegendLinks is free with unlimited links and sites. No credit card required.
Your affiliate URLs
The raw affiliate links from your affiliate programs (Amazon, ShareASale, CJ, etc.)
Install a Link Cloaking Plugin
Log in to your WordPress dashboard and navigate to Plugins → Add New. Search for "LegendLinks" in the search bar.
Click Install Now, then click Activate. LegendLinks will automatically create its database tables and add a new menu item in your WordPress sidebar.
Tip: LegendLinks uses a modern React-based interface instead of the traditional WordPress admin. It loads instantly and feels like a standalone app inside your dashboard.
Create Your First Cloaked Link
Click LegendLinks in your WordPress sidebar to open the dashboard. Then click the Add New Link button.
Fill in the following fields:
Title: A descriptive name for your link (e.g., "Bluehost Hosting"). This is for your reference only and is not shown to visitors.
Destination URL: Paste your full affiliate URL here (e.g., https://bluehost.com/?ref=your-id).
Slug: Choose a clean, memorable path (e.g., /recommends/bluehost). LegendLinks lets you customize the prefix — popular choices include /go/, /recommends/, and /refer/.
Click Save and your cloaked link is live. Visitors who click yourdomain.com/recommends/bluehost will be seamlessly redirected to your affiliate URL.
Configure Redirect Settings
When creating or editing a link, you can choose the redirect type. Each type behaves differently and is suited for specific use cases:
301 — Permanent Redirect
Tells search engines the redirect is permanent. Best for SEO when you want link equity passed to the destination. Not ideal for affiliate links since browsers cache the redirect.
302 — Temporary Redirect (Default)
The recommended default for affiliate links. Search engines treat the redirect as temporary, so they index your cloaked URL instead of the affiliate URL. Browsers do not cache it.
307 — Temporary Strict Redirect
Similar to 302 but strictly preserves the HTTP method (GET, POST). Use this when you need guaranteed method preservation, such as with form submissions or API callbacks.
Stealth — JavaScript Redirect
Uses JavaScript to perform the redirect, which bypasses most ad-blockers and referrer-stripping tools. Available in LegendLinks Pro. Ideal when ad-blockers interfere with your affiliate links.
Recommendation: Stick with 302 (the default) for most affiliate links. Only use 301 for non-affiliate permanent redirects, and consider Stealth if you notice ad-blockers reducing your click-through rates.
Add the Link to Your Content
Now that your cloaked link is created, you can use it anywhere on your WordPress site. There are several ways to insert it:
Copy and paste the URL
Copy your cloaked URL from the LegendLinks dashboard and paste it as a hyperlink in any post or page using the WordPress block editor.
Use the Auto-Linker feature
LegendLinks can automatically convert specific keywords in your content into cloaked affiliate links. Set a keyword like "Bluehost" and every mention across your site becomes a cloaked link — no manual editing required.
Insert via shortcode
Use the LegendLinks shortcode in classic editor or widgets to insert links anywhere shortcodes are supported.
Set Up Click Tracking
LegendLinks automatically tracks every click on your cloaked links. Navigate to the Analytics section in the LegendLinks dashboard to see:
Total Clicks
Track how many times each link has been clicked, with daily, weekly, and monthly breakdowns.
Referrer Data
See which pages on your site are driving the most affiliate clicks so you can optimize your best content.
Geographic Data
Understand where your clicks come from with country and region-level tracking to inform your geo-targeting strategy.
Pro tip: Click tracking is enabled by default in LegendLinks. No additional configuration is needed — just create your links and the analytics start collecting data immediately.
Configure Advanced Features (Optional)
LegendLinks Pro includes powerful advanced features that let you maximize your affiliate revenue:
Geo-Targeting
Redirect visitors to different affiliate URLs based on their country. Send US visitors to the US Amazon store and UK visitors to the UK store — automatically.
Device Targeting
Send mobile users to an app download page and desktop users to a web page. Perfect for app affiliate programs or mobile-optimized landing pages.
A/B Testing
Split traffic between two destination URLs to test which merchant or landing page converts better. LegendLinks tracks conversion data so you can pick the winner.
Redirect Types Explained
| Type | Behavior | Best For | SEO Impact |
|---|---|---|---|
| 301 Permanent | Cached by browsers; passes link equity | Permanent page moves, SEO redirects | Passes ~90-99% link equity |
| 302 Temporary | Not cached; preserves original URL indexing | Affiliate links (recommended default) | No equity passed; original URL indexed |
| 307 Temporary Strict | Not cached; strictly preserves HTTP method | Form submissions, API callbacks | Same as 302 |
| Stealth (JS) | JavaScript-based; invisible to ad-blockers | Links blocked by ad-blockers | No SEO impact (client-side only) |
Common Mistakes to Avoid
Cloaking Amazon links
Amazon prohibits link cloaking in their Terms of Service. Doing so can get your affiliate account banned. Use LegendLinks' smart uncloaking feature instead — it automatically detects Amazon URLs and serves them without cloaking while still tracking clicks.
Not disclosing affiliate relationships
The FTC requires clear disclosure of affiliate relationships. Cloaked links make URLs cleaner, but you still must inform readers that you earn commissions. Add a disclosure statement at the top of every page with affiliate links.
Using 301 redirects for affiliate links
301 redirects are cached by browsers, which means changes to your affiliate URL will not take effect for users who have visited the link before. Additionally, 301s pass link equity to the affiliate URL, which is usually undesirable. Use 302 instead.
Not tracking clicks
Without click tracking, you are flying blind. You will not know which links perform best, which pages drive the most affiliate revenue, or which links are broken. LegendLinks tracks clicks automatically — make sure you review your analytics regularly.
Frequently Asked Questions
Is affiliate link cloaking legal?
Yes, affiliate link cloaking is legal. However, the FTC requires that you disclose affiliate relationships to your audience. Always include a clear affiliate disclosure on pages where you use affiliate links, regardless of whether they are cloaked or not.
Does link cloaking affect SEO?
No, properly cloaked affiliate links do not negatively affect SEO. In fact, cloaking can improve SEO by keeping your URLs clean and consistent. Use 302 redirects (the default in LegendLinks) for affiliate links so search engines do not pass link equity to affiliate URLs.
Can I cloak Amazon affiliate links?
Amazon's Terms of Service prohibit traditional link cloaking. However, LegendLinks offers a smart uncloaking feature that automatically detects Amazon URLs and serves them without cloaking, keeping you compliant while still managing all your links in one place.
What is the difference between link cloaking and link shortening?
Link shortening creates a shorter URL (like bit.ly links) that redirects to the original. Link cloaking replaces the entire affiliate URL with a branded URL on your own domain (like yourdomain.com/recommends/product). Cloaking gives you full control, branding, and protection against commission theft.
How many affiliate links can I cloak with LegendLinks?
LegendLinks has no limit on the number of links you can create, even on the free plan. You can cloak unlimited affiliate links across unlimited WordPress sites without paying anything. Premium features like geo-targeting and stealth redirects are available in Pro plans.
LegendPlugins Team
The LegendPlugins team builds high-performance WordPress plugins for affiliate marketers and content creators. With deep expertise in WordPress development, database optimization, and affiliate marketing workflows, we create tools that help publishers maximize their revenue.
Ready to try LegendLinks?
Start managing your affiliate links with zero-latency redirects.
Download Free Plugin