WordPress Redirects Done Right: 301, 302, Cloaking & More

· first published 2020 · canyonthemes

How Casino Sites Create Redirects On WordPress Sites

Every WordPress site that has been live for more than a year has URLs it no longer wants: renamed posts, retired categories, campaign pages, a language folder that was removed. Each one either redirects or serves a 404, and a 404 throws away the links, rankings and visitors that URL had earned. Redirects are not an SEO trick; they are basic maintenance, and WordPress gives you three places to do them, each with trade-offs.

Sites with fast-moving content feel this first. Vera John Casino, which we used as the example in the original version of this article, publishes weekly and seasonal promotion pages that are edited, moved and removed constantly; without a redirect for every retired page, a visitor arriving from search on an old link gets an error and leaves. Replace “promotion” with “product”, “event” or “job listing” and the situation is the same on any business or publishing site.

Which status code, and when

Browsers and crawlers follow the 3xx series of HTTP status codes. Two matter for day-to-day WordPress work and two more are worth knowing.

CodeMeaningUse it forSEO effect
301Moved permanentlyRenamed slugs, merged posts, removed pages, domain or HTTPS movesSignals and rankings transfer to the new URL
302Found (temporary)Maintenance, short-term campaign swaps, A/B routingOld URL keeps its equity; Google treats long-lived 302s as 301s anyway
307Temporary, method preservedForm endpoints, APIsSame as 302
410GoneContent deleted with no replacementFaster de-indexing than a 404

Default to 301. Use 302 only when you genuinely intend to bring the original URL back. Use 410 when there is no relevant destination — redirecting every dead page to the homepage is treated as a soft 404 and gives you nothing. We cover the finer points in using 301 and 302 redirects for the best results.

Method 1: A redirect plugin (default for most sites)

For ongoing content changes, a plugin is the right tool because redirects become part of editing rather than a separate technical task.

  • Redirection (free) — the standard. Logs 404s so you can see what to redirect, supports regex groups, and can auto-create a 301 when you change a post slug. Turn on the 404 log, review it monthly, then turn it off if the table grows large.
  • Yoast SEO Premium — redirect manager built into the SEO plugin; prompts you to redirect when you trash or rename a post.
  • Safe Redirect Manager — minimal, whitelists destinations, good for agencies who want fewer options for clients.
  • Rank Math — includes a redirect module in the free version.

Plugin redirects run after WordPress loads, so they are marginally slower than server rules — a few milliseconds, irrelevant for hundreds of rules, noticeable at tens of thousands. Keep the rule list clean: delete redirects for URLs that have had zero hits for a year.

Method 2: Server level (.htaccess or Nginx)

Use the server for structural, permanent, high-volume rules: HTTP to HTTPS, www to non-www, a whole directory moving, a domain migration. These fire before PHP runs and cost nothing.

On Apache, edit .htaccess in the site root via SFTP after taking a backup. Place custom rules above the # BEGIN WordPress block, because WordPress rewrites that block on permalink saves.

# Single page
Redirect 301 /old-page/ https://www.example.com/new-page/

# Whole folder, keeping the rest of the path
RedirectMatch 301 ^/nl/(.*)$ https://www.example.com/$1

That second rule is the one we use on this site. After removing WPML, every /nl/ URL 301s to its English equivalent — one line instead of several hundred plugin entries, and it runs before WordPress boots. On Nginx the equivalent goes in the server block as a rewrite ^/nl/(.*)$ https://www.example.com/$1 permanent; line; managed hosts usually expose this through their control panel. If your host does not let you edit server config, that is a reason to consider moving.

Method 3: Theme or code level

You can call wp_redirect() or wp_safe_redirect() on the template_redirect hook from a small plugin or a child theme’s functions.php. This is appropriate for conditional logic a plugin cannot express — redirecting based on user role, query parameter or post meta. Two rules: put it in a site-specific plugin rather than the theme so a theme change does not break redirects, and always pass the status code explicitly (wp_safe_redirect( $url, 301 ); exit;), because the default is 302.

Affiliate link cloaking: what is allowed

“Cloaking” in the affiliate sense — a short internal URL like /go/hosting-provider/ that 302s or 307s to a long tracking link — is fine and Google says so. It becomes a problem when the redirect is used to show crawlers different content than users, or when the internal URL is presented as an editorial link. Rules that keep you safe:

  • Add rel="sponsored nofollow" to every affiliate link, including the short internal ones. Pretty Links and ThirstyAffiliates do this automatically.
  • Block the redirect folder in robots.txt (Disallow: /go/) so crawlers do not follow the chain.
  • Use a server-side redirect, never JavaScript or a meta refresh. Client-side redirects to a different domain look like sneaky redirects.
  • Keep a disclosure line on the page.

What Google actually penalises

Redirects themselves are never penalised. These patterns are:

  • Sneaky redirects — users land somewhere different from what the crawler saw, typically via JavaScript or user-agent detection.
  • Redirecting expired domains bought for their backlinks to unrelated content.
  • Mass redirects to the homepage — treated as soft 404s; no penalty, but no value transferred either.
  • Redirect chains and loops — not a penalty, but each hop leaks crawl budget and slows the page. Point old URLs directly at the final destination and fix chains when you change a slug twice.

A redirect workflow for editors

  1. Before deleting or renaming anything, check Search Console for its clicks and backlinks.
  2. If it has either, 301 it to the closest live equivalent — not the homepage.
  3. If nothing relevant exists, return 410.
  4. Once a month, open the 404 log in Redirection and clear the top entries.
  5. After any bulk change (category restructure, plugin removal, migration), crawl the site with Screaming Frog or a similar tool and fix chains.

Which Canyon theme fits

Redirects are theme-independent, but a theme that avoids custom URL structures makes them easier. All Canyon themes use standard WordPress permalinks and post types, so nothing breaks when you switch.

  • Danfe — business sites with rotating service and campaign pages.
  • Bloge — publishing sites where slugs get renamed as content is refreshed.
  • News One — high-volume sites where category restructures are common.

FAQ

Should I use a plugin or .htaccess for WordPress redirects?
Both. Use .htaccess or Nginx for permanent structural rules such as HTTPS, www and folder moves; use a plugin like Redirection for the ongoing one-off redirects editors create when renaming or removing content.
Do 301 redirects lose PageRank?
Google has stated since 2016 that 301, 302 and 307 redirects no longer lose PageRank. Chains and redirects to irrelevant pages still waste value, so point old URLs directly at the closest live equivalent.
Is cloaking affiliate links with a redirect against Google's guidelines?
No, provided the link carries rel=sponsored, the redirect is server-side and the destination is what the user expects. Cloaking becomes a violation when crawlers and users see different content.