WordPress Redirects Made Easy: Plugin & Code Methods

3 weeks ago 20

WordPress redirects guarantee your users (and Google) tin find your contented erstwhile you:

  • Change the URL
  • Combine 2 pieces of content
  • Move your full tract to a caller domain

Using redirects avoids creating breached links (bad for idiosyncratic experience), oregon losing the authorization of your backlinks (bad for your SEO).

In this guide, I’ll amusement you however to redirect your WordPress URLs with and without plugins.

When Should You Use WordPress Redirects?

You typically acceptable up WordPress redirects immoderate clip you privation visitors (and hunt engines) to extremity up astatine a antithetic URL than the 1 they primitively tried to access.

That mightiness beryllium due to the fact that you changed an aged link, oregon due to the fact that you’re investigating a caller landing page.

Here’s a speedy breakdown of the astir communal scenarios:

Use Case Example Why It Matters
Changing leafage URLs You updated your station slug from /old-page to /new-page A redirect ensures visitors who save, bookmark, oregon click the aged nexus don’t onshore connected a 404 error
Deleting oregon merging content You region outdated pages oregon harvester 2 posts into one Redirects successful these cases guarantee you don’t suffer invaluable backlinks
Rebranding oregon domain changes You power from olddomain.com to newdomain.com A sitewide redirect preserves your site’s SEO and minimizes postulation mislaid during the migration
Temporary promotions You make a vacation merchantability leafage that’s progressive for 1 week A impermanent (302) redirect lets you nonstop postulation to the peculiar offer, past you tin revert backmost to the archetypal URL erstwhile it’s over

Types of WordPress Redirects

You’ll mostly trust connected 2 cardinal types of redirects: 301 and 302. (Even then, 301 is the benignant you’ll apt usage astir often.)

While determination are others (like meta refresh), they don’t travel up astir arsenic often successful day-to-day tract absorption (and they’re typically not champion signifier either). So I won’t speech astir them here.

There are besides subtle variations of these modular redirects (like 307 and 308 redirects). But these person precise circumstantial usage cases that astir tract owners don’t request to interest about.

(If you bash privation to larn much astir these, cheque retired this extended redirects guide.)

Here’s a summary of what you really request to know:

301 Permanent Redirect

This is the go-to redirect for immoderate leafage determination that’s meant to past forever. You usage it erstwhile you’ve changed your URL structure, merged content, oregon changed your domain.

Merging 2  URLs

Search engines dainty this arsenic a imperishable alteration and usually transfer astir of the aged page’s authority to the caller page.

302 Temporary Redirect

You usage 302 redirects erstwhile you program to nonstop visitors to a caller leafage for a constricted time.

This could beryllium erstwhile you’re moving a seasonal promotion oregon an A/B trial to spot which mentation of your leafage performs best.

301 vs 302 Redirects

A 302 redirect tells hunt engines that the aged URL is coming backmost eventually, truthful they shouldn’t transportation the SEO worth to the caller leafage conscionable yet.

What to Do Before You Create WordPress Redirects

Redirecting pages, nary substance wherefore oregon however you bash it, ever comes with an inherent risk.

It’s casual to marque mistakes, similar creating redirect chains:

Redirect chain

Or redirect loops:

Redirect loop

So it’s champion to bash immoderate readying earlier you get started.

Understand What Kind of WordPress Site You Own

There are 2 flavors of WordPress:

  • WordPress.com: These sites are built connected and hosted by WordPress
  • WordPress.org: These sites tally the WordPress software, but you big them elsewhere

Most sites you’ll spot talking astir WordPress redirects, and everything I’ll sermon below, lone truly applies to owners of sites moving via WordPress.org.

Sites moving connected WordPress.com typically person much constricted customization options, and this applies to redirecting URLs.

For example, users connected WordPress’s cheapest program can’t instal plugins, truthful they won’t beryllium capable to redirect URLs with this method.

WP – Pricing

This means you’ll request to usage WordPress’s built-in redirect tool. You tin larn much astir the antithetic usage cases successful this enactment article.

If you tally a WordPress.org tract (i.e., you wage for abstracted hosting), you tin usage either of the methods below.

Create a Backup

It’s ever a bully thought to backmost up your tract earlier making immoderate important changes—redirects included.

Most bully web hosts connection an enactment for this, but you’ll besides find outer solutions and adjacent WordPress plugins to bash it for you.

Hostinger – Backup Options

Create a URL Map

Another bully thought if you’re redirecting a batch of URLs oregon moving to a caller domain is to representation each of your existent URLs to their caller versions.

You tin bash this utilizing tools similar Screaming Frog to get a broad database of each your site’s pages. Or, if your tract isn’t that big, conscionable make a database manually (with the assistance of your sitemap).

ScreamingFrog

This gives you a notation for mounting up each the redirects. And you tin tick them each disconnected arsenic you enactment them successful spot and verify that they work.

Consider Whether You Need a Redirect

Finally, see whether you adjacent request a redirect astatine all. I’ve covered a fewer communal situations above, but sometimes you mightiness beryllium amended off:

  • Updating the contented and keeping the existent URL
  • Deleting the page
  • Leaving it arsenic is

For example, you mightiness person outdated contented oregon a leafage that’s nary longer relevant, but nary applicable leafage to redirect it to.

But you don’t privation to suffer the postulation oregon backlinks that station has attracted implicit time. In this case, it’s often conscionable champion to permission it arsenic is.

Here’s a flowchart to assistance you determine what to do:

When To Use Redirects

But if you bash request a redirect, here’s however to instrumentality them.

Note: It should spell without saying that you’ll request to ain the domain you’re redirecting. Otherwise anyone could redirect immoderate domain to their ain website.

How to Redirect WordPress URLs with a Plugin

Using a plugin is by acold the easiest mode to grip redirects successful WordPress. You don’t person to interaction immoderate code, and they’re usually beauteous casual to acceptable up.

Here’s an overview of the astir fashionable WordPress plugins for creating redirects:

Plugin Key Benefit Price
Redirection Handles 301 redirects with a elemental interface Free
301 Redirects Quick setup for basal redirects Free (with optional paid plans)
Rank Math Offers precocious SEO tools positive auto-redirects erstwhile you alteration URL slugs Free (Premium available)
Yoast All-in-one SEO plugin Paid (annual license)
AIO SEO A scope of SEO features and elemental redirects Paid (annual plans)

Note: I won’t beryllium going done each the steps for mounting each of these up. In astir cases, it’s thing similar this:

  • Install plugin
  • Navigate to the redirects/redirections paper wrong that plugin’s settings
  • Set up your redirects

I’ll amusement the main interface for each 1 below, but it’s beauteous self-explanatory. The main things to see are immoderate different plugin features you mightiness request and whether you tin bash it for free.

Redirection

Types of redirects: 301/302/303/304/307/308

Redirection is the astir fashionable escaped plugin for elemental 301 redirects.

Redirection – Add Redirect

It does precisely what the sanction implies and is simply a plugin purely for creating and managing redirects.

You tin adhd caller redirects precise easily, and the plugin automatically tracks immoderate 404 errors connected your site.

Redirection – Basic Setup

Plus, if you update the URL of a page, you tin acceptable it to automatically make a redirect for it.

That means you don’t request to interest astir broken links appearing that could outgo you postulation and rankings.

You tin besides take assorted HTTP presumption codes for pages. This is useful if you’re deleting contented and privation the URL to nonstop a 410 gone presumption code, for example.

Redirection – Match Status

The Redirection plugin tin besides grip a fewer utile sitewide redirects:

  • HTTP to HTTPS
  • Removing WWW
  • Adding WWW
Redirection – Canonical Settings

As I’ll amusement you later, you tin acceptable these kinds of redirects up done .htaccess. But if you privation a simple, no-code mode to bash it, this is SUPER useful.

If you’re looking for thing lightweight and focused purely connected redirects, this plugin is simply a large choice.

301 Redirects

Types of redirects: 301/302/307

301 Redirects is different enactment if you conscionable privation basal nexus redirection without immoderate other features.

301 Redirects – Redirect Rules

The escaped mentation handles astir communal redirect scenarios done a elemental interface.

But there’s a premium mentation disposable if you privation different features like:

  • Redirect absorption and matching rules
  • Detailed 404 monitoring
  • Link scanning

Rank Math

Types of redirects: 301/302/307

Rank Math is an all-in-one SEO plugin that besides lets you make redirects—without needing a premium subscription.

RankMath – Add Redirection

Note that you tin acceptable up 3 types of redirects and take 410 oregon 451 presumption codes.

Its standout diagnostic (for this discussion) is the auto-redirect function: erstwhile you alteration a URL slug, the plugin sets up a redirect for you automatically.

This saves you from having to retrieve to bash it yourself.

RankMath – Auto Post Redirect

It besides includes an array of different SEO tools—like keyword optimization and schema settings.

So, if you request a plugin that tin grip different aspects of your site’s SEO, Rank Math is simply a bully pick.

Yoast

Types of redirects: 301/302/307/410/451

Yoast is 1 of the astir fashionable SEO plugins for WordPress.

Yoast – Redirect

The downside is that you request the premium mentation to entree the built-in redirect manager. If you’re already utilizing Yoast Premium for different features though, it’s a no-brainer.

You’ll get a user-friendly interface for mounting up 301 oregon 302 redirects (and 410/451 presumption codes), and it’ll automatically acceptable up redirects erstwhile you alteration URLs.

AIO SEO

Types of redirects: 301/302/303/304/307/308

AIO SEO (All successful One SEO) is different heavyweight successful the SEO world. It offers redirect features, but you request a paid subscription to unlock them.

AIOSEO – Redirects

In return, you get a clean, well-structured dashboard wherever you tin negociate redirects alongside different SEO tasks.

Like the others, the redirect manager is straightforward—just participate the aged URL, the caller URL, and save.

If you’re already utilizing AIO SEO for keyword optimization oregon sitemap management, upgrading for the redirect module could marque sense.

Note: You astir apt won’t privation to usage immoderate operation of Rank Math, Yoast, and AIO SEO. They each bash galore of the aforesaid things, and conflicts betwixt them tin origin issues with your site.

How to Set Up a Redirect successful WordPress via .htaccess

If you’re comfy taking a much hands-on approach, you tin skip plugins wholly and make redirects by editing your site’s .htaccess file.

(Note that this lone applies to WordPress sites moving connected Apache, not Nginx.)

This record tells your server however to grip definite requests, and it’s often utilized for things similar permalinks and redirect rules.

It tin beryllium faster than installing a plugin, and if you already person tons of plugins connected your site, it limits however overmuch other “bloat” you adhd to it.

In different words: your tract mightiness tally faster.

The drawback is that one incorrect enactment of codification tin bring your full tract down. So I powerfully urge you consult your developer if possible. Or, astatine the precise least, instrumentality a batch of attraction erstwhile doing it yourself.

How to Access .htaccess

The accustomed method to edit your .htaccess record involves an FTP client. This is simply a “file transportation protocol” programme that lets you entree your server’s files from your computer.

There are tons of options, similar Cyberduck, FileZilla, and WinSCP.

Cyberduck – FTP

Check retired this usher to .htaccess files for a walkthrough of however to bash this.

In galore cases, you tin edit your .htaccess record close wrong your hosting power sheet (like cPanel oregon a akin dashboard).

Look for a “File Manager” oregon thing similar:

File Manager

Then, look successful your site’s basal folder (often called public_html) for your .htaccess file.

It mightiness beryllium hidden by default—there’s usually an enactment successful your settings to alteration that.

File Manager – htaccess

You’ll spot lines of codification that mightiness look a spot intimidating, but don’t panic.

You don’t request to edit immoderate of them. We’ll conscionable beryllium adding immoderate further lines of codification to our .htaccess file.

Before You Start

For immoderate redirects, you’ll request to adhd a fewer lines of codification similar this:

Options +FollowSymLinks RewriteEngine On

You don’t request to interest excessively overmuch astir what this does, but fundamentally it lets you adhd definite rules that’ll execute circumstantial types of redirects. (Some hosts mightiness alteration the archetypal enactment by default, but it’s good to adhd it present anyway.)

You don’t request these for a basal azygous redirect, but you volition for the much analyzable ones.

You besides lone request to adhd it erstwhile successful your .htaccess file (provided you don’t besides person “RewriteEngine Off” determination other successful the file). But I’ve included it successful each of the instances beneath that necessitate it.

Finally, it’s important to enactment that these .htaccess rules don’t “create” immoderate caller pages.

You request to guarantee the pages you’re redirecting to are unrecorded erstwhile you adhd the rule. Otherwise the redirect volition pb to an mistake page.

With that successful mind, present are the astir communal types of WordPress redirects you tin adhd to your .htaccess file. In each case, adhd them astatine the commencement of your .htaccess file.

Free resource: To marque things adjacent easier, download our free .htaccess WordPress redirects cheat sheet.

Redirecting a Single Page

To redirect a azygous leafage utilizing your .htaccess file, adhd this enactment of code, replacing the /old-url and /new-url parts with your ain URLs:

Redirect 301 /old-url https://yourdomain.com/new-url

Note: The archetypal portion (/old-url) should beryllium the comparative signifier of the URL. But the 2nd portion should beryllium the afloat URL, including the protocol (https://) and domain name.

Redirecting a Single Folder

When you privation to redirect a folder (e.g., moving a /blog class implicit to your /news category), usage this code:

Options +FollowSymLinks RewriteEngine On RewriteRule ^blog/(.*)$ /news/$1 [L,R=301]

Again, you’d regenerate the blog and quality parts with your ain folder names.

But what bash each the different parts mean?

You don’t request to cognize the specifics, arsenic determination are tons of imaginable combinations. But this peculiar lawsuit does the following:

  • ^ means “start looking astatine the opening of the URL path”
  • blog/ is the folder we’re redirecting from
  • (.*) captures everything aft blog/ (think of it similar copying it to the clipboard)
  • $ fundamentally says “that’s the extremity of what we’re looking for”
  • /news/ is the caller folder we’re redirecting to
  • $1 fundamentally “pastes” everything we “copied” with (.*) into the caller location
  • L means halt processing rules for this circumstantial petition erstwhile it matches this rule
  • R=301 means it’s a 301 redirect (as opposed to 302, for example)

So, it would redirect a URL like:

https://yourdomain.com/blog/post-1

To:

https://yourdomain.com/news/post-1

Redirecting to a New Domain

Redirecting to a caller domain is wherever things tin get tricky. Having done this myself, I powerfully urge you talk to your developer first.

But if you program to bash it yourself, here’s 1 illustration of a regularisation you tin adhd to your .htaccess record (obviously subbing successful your circumstantial aged and caller domains, with oregon without www arsenic required):

Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?olddomain.com [NC] RewriteRule ^(.*)$ https://newdomain.com/$1 [L,R=301]

As with redirecting folders, determination are a batch of symbols successful there. I won’t spell implicit them each individually, but present are a fewer important parts:

  • RewriteCond %{HTTP_HOST} fundamentally means “check what domain the idiosyncratic is trying to access”
  • ^(www.)? matches either www. oregon thing astatine the commencement of the domain—this ensures it catches some www.olddomain.com and olddomain.com
  • [NC] means “not lawsuit sensitive,” truthful OLDDOMAIN.com would besides match
  • ^(.*)$ captures the full URL way aft the domain (like /about oregon /contact)

So this codification would redirect:

  • https://olddomain.com/about > https://newdomain.com/about
  • https://www.olddomain.com/blog > https://newdomain.com/blog
  • https://olddomain.com/product/item > https://newdomain.com/product/item

This maintains the aforesaid operation for each URL but connected the caller domain.

You tin tweak immoderate of the symbols to drawback oregon disregard circumstantial parts of the URL. But again, it’s astir apt champion to question assistance from your developer if you request a much precise solution.

Remember: This .htaccess regularisation doesn’t make immoderate pages connected the caller site.

If you effort to redirect “olddomain.com/example-page” but there’s nary “newdomain.com/example-page” oregon its URL is somewhat antithetic (e.g., newdomain.com/example-page1), the idiosyncratic volition get a 404 error.

That’s wherefore you should make a redirect representation earlier starting a tract move. For much connected this, spot our website migration checklist.

Redirecting HTTP to HTTPS

You tin besides redirect your website from HTTP (unsecure) to HTTPS (secure) via .htaccess. (You’ll, of course, request a valid SSL certificate.)

However:

You mightiness not request to. There’s a bully accidental your web big offers a method to bash this for you. Or you mightiness already person a plugin that does it.

Domains – Force HTTPS

In either case, you shouldn’t past adhd a abstracted .htaccess regularisation to redirect to HTTPS. Doing truthful tin really pb to issues.

But if you bash privation to adhd it, here’s the code:

Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

You tin transcript and paste this regularisation straight into your .htaccess record without subbing thing in.

Redirecting WWW to Non-WWW

As with redirecting to HTTPS, you tin usually redirect from the www. mentation of your website without touching your .htaccess file.

One method is done your WordPress dashboard’s “General” settings tab. Just participate the URL you privation to usage for your domain sanction successful the “WordPress Address” and “Site Address Boxes”:

WP – Redirect

But if you privation to bash this via .htaccess, here’s the codification to adhd (you tin transcript and paste it successful without changing anything):

Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

Remember: You lone request to adhd 1 lawsuit of “RewriteEngine On” successful your .htaccess file.

Pros and Cons of Using .htaccess for WordPress Redirects

The main advantages of utilizing .htaccess to redirect WordPress URLs include:

  • Fewer plugins, little bloat: Every plugin you instal tin dilatory down your site. Changes to .htaccess don’t trust connected tons of other codification moving successful the background.
  • Extra control: You tin acceptable up precocious redirect rules, and you tin beryllium precise circumstantial astir what does and doesn’t redirect.
  • Fast execution: Because .htaccess rules tally astatine the server level, your redirects hap quickly.

But determination are a fewer drawbacks:

  • Risk of breaking your site: One tiny typo tin origin large errors. Double-check everything, and ever support a backup.
  • No built-in tracking: Unlike plugin dashboards that log errors and hits, you won’t spot which URLs person triggered the redirect unless you cheque your server logs.
  • Potential show impact: While the existent redirects mightiness beryllium fast, adding tons of .htaccess rules could interaction wide show and page speed (although it won’t beryllium noticeable successful astir cases).

A large caveat here, though, is that which method is close for you volition beryllium connected however galore redirects you request to instrumentality and the quality of them.

Need to redirect a mates of pages, and privation an casual mode to bash it arsenic needed?

The apt tiny show interaction of a azygous plugin is astir apt worthy it for the flexibility and convenience.

Redirecting 1 URL?

It’s astir apt astir businesslike to adhd it to your .htaccess record (it’s conscionable 1 enactment of code).

Performing a monolithic tract migration with thousands oregon millions of redirects?

For monolithic sites, it’s astir apt not worthy taking immoderate risks trying to usage a plugin oregon editing your .htaccess file. This is wherever you’ll apt privation to question adept assistance.

How to Check Your WordPress Redirects Are Working

Whether you acceptable your redirects up utilizing a plugin oregon via .htaccess, I urge investigating to marque definite they enactment as soon arsenic you’ve implemented them. This lets you hole errors earlier they interaction your users (or your SEO).

You tin bash this manually by checking the URLs if you didn’t make that galore redirects.

But if you person tons of them, you tin usage a instrumentality similar Semrush’s Site Audit to cheque for issues crossed your full site.

You conscionable acceptable up your audit and erstwhile it runs, you’ll caput to the “Issues” tab.

Search for “links” to bring up immoderate applicable issues:

Site Audit – Issues – Links

Pay peculiar attraction to these errors and warnings:

  • # interior links are broken
  • # pages returned 4XX presumption code
  • # redirect chains and loops
  • # pages with a breached canonical link
  • # links couldn’t beryllium crawled (incorrect URL formats)
  • # links connected HTTPS pages pb to HTTP page

These often hap erstwhile you instrumentality tons of redirects and acceptable up immoderate (or all) of them incorrectly.

You tin audit your tract for escaped for up to 100 URLs. But for crawling much than that, try a Pro program for escaped for 14 days with this link.

The station WordPress Redirects Made Easy: Plugin & Code Methods appeared archetypal connected Backlinko.

Read Entire Article