Home Tutorials How to Redirect a URL in WordPress

How to Redirect a URL in WordPress

Updating your WordPress website’s hyperlinks may be a easy activity in idea. Nevertheless, in case you get the method fallacious, guests may find yourself at a completely different, unintended web page, and even worse — a damaged hyperlink. This has loads of impression in your search engine rankings, site visitors numbers, and general authority.

WordPress offers quite a few easy-to-use plugins to redirect URLs for many who are unfamiliar with the method. This may help you to be sure you’re redirecting your URLs accurately.

On this tutorial, I’ll present you ways to efficiently redirect a WordPress URL, in addition to the primary forms of URL redirects and when to use which one.

Nevertheless, let’s first talk about what a URL redirect is and the way it works!

What Is a URL Redirect

URL redirection (additionally referred to as URL forwarding) is a approach to make a net web page accessible below a number of URL addresses.

When the browser performs a URL redirect, a web page with a completely different URL will probably be opened in place of the unique one.

There are a number of methods to redirect a URL, and every has its personal functions — let’s see the three most typical varieties.

1. 301 Redirects

For starters, a 301 redirect is everlasting, going down on each the browser and server aspect. It’s the commonest and highly effective redirect as a result of it passes on the ‘hyperlink juice’ of an current URL.

As a end result, search engines like google are extra seemingly to acknowledge and index this kind of redirect, making this the popular methodology in most conditions.

2. 302 Redirects

In distinction, a 302 redirect is short-term and will solely be used in case you plan to transfer again to the unique URL in the longer term.

For instance, let’s say you’re redesigning your web site. If you are updating your web site, you should utilize a 302 redirect to direct customers to a completely different area for a quick time.

3. Meta Refresh

Internet browsers even have a meta refresh performance, which helps you to redirect a URL to a new web page with out updating the server.

You may set the period of time it takes for the redirect to occur, however by doing so, you additionally run the chance of creating your guests wait to get to their subsequent web page vacation spot, thus doubtlessly creating a poor consumer expertise.

Whereas there are different forms of redirects you would use, these three are those you will notice probably the most typically — particularly 301 redirects.

Why Use a URL Redirect

You might surprise why you’d ever want to use a URL redirect by yourself web site.

We’ve touched on some causes in the earlier part, though there are others too, resembling:

  • Stopping damaged hyperlinks – Damaged hyperlinks happen when the vacation spot web page has been moved or deleted or one thing resembling a firewall is obstructing entry to your web site. When customers comply with a damaged hyperlink, they see a 404 error message in the browser. In accordance to Web optimization specialist Bruce Clay, redirects are probably the most Web optimization-friendly approach to repair damaged hyperlinks.
  • Linking a number of domains – For those who handle a number of web sites, you should utilize a redirect to hyperlink them to the identical vacation spot with out affecting your Web optimization. Redirects assist search engines like google see which web page is the canonical supply when a number of pages show the identical info. That is additionally nice for avoiding duplicate content material penalties.
  • Defending your privateness – Utilizing the facility of HTTPS, you possibly can safe your web site from hostile assaults resembling phishing or malware distribution. Doing so requires you to redirect customers and search engines like google to the HTTPS web page, or useful resource with a server-side 301 HTTP redirect.

It doesn’t matter what motive you might have for redirecting customers to a new web page, it’s important that you just take the time to hyperlink it correctly. An incorrect redirect can lead your guests to the house web page as a substitute of the supposed one, end result in extreme redirects, and extra.

How to Redirect a URL in WordPress (2 Strategies)

There are two major strategies to redirect a URL in WordPress — you possibly can both use a plugin or edit the .htaccess file.

Let’s begin with a traditional WordPress strategy.

1. Use a WordPress Plugin

Redirect plugins can be sure that damaged hyperlinks lead to a related web page in your website. This manner, if a customer occurs to click on a damaged hyperlink, they are going to be redirected to the brand new web page, which improves your web site’s credibility and prevents your search rankings from dropping.

Whereas there are many nice plugins to select from, resembling 301 Redirects, I like to recommend the Redirection plugin.

Redirection is exceptional for a lot of causes — not solely has it been round for over a decade, nevertheless it additionally lets first-time customers create and handle redirects with none prior information of the Apache or Nginx net servers.

Redirection plugin

As Redirection offers full assist for normal expressions, you possibly can allow redirect patterns to match any quantity of URLs and redirect all of them to a goal URL. You can too look ahead to adjustments in put up or web page permalinks, then robotically create a redirect to a new URL.

When you’ve put in and activated the plugin, click on the Instruments > Redirection menu in your WordPress admin space, and run by way of the setup wizard steps.

The Redirection Onboarding Wizard.

Once you’re achieved, head to the Redirects tab on the identical admin web page. This reveals a listing of present redirects. So as to add a recent redirect, click on the Add New button.

Adding a new redirection.

You’ll then see a bunch of fields pop up, together with:

  • Supply URL – That is the URL you’re redirecting from. For instance, in case you’re redirecting from https://myexample.com/old-post, your supply URL will probably be /old-post.
  • Question Parameters – You may match parameters precisely (the default possibility) or ignore all parameters. With the latter, /old-post would match /my-old-post?question=1.
  • Goal URL – That is the URL you’re redirecting to. For instance, in case you’re redirecting from https://myexample.com/old-post to https://myexample.com/new-post, your goal URL will probably be /new-post.
  • Group – This allows you to set up your redirects into classes.

Clicking on the gear icon will present some extra choices for matching redirects. As soon as these fields are crammed in, click on Add Redirect and the plugin will create the redirection rule.

2. Edit Your .htaccess File

The ‘hypertext entry’ file — in any other case generally known as .htaccess — is a distributed server configuration file, which allows you to set server configurations for a explicit listing. It’s utilized by the server when a request is made to a listing.

Whereas it’s not so simple as putting in a plugin, this highly effective strategy enables you to arrange pages, directories, and URL redirects. Earlier than you start, you’ll want the next abilities and instruments:

  • An appropriate FTP shopper, resembling Cyberduck or FileZilla
  • Entry to your web site’s server, normally named www or public_html
  • The requisite abilities to use FTP

First, you want to fireplace up your FTP shopper and entry your WordPress website’s root listing. Scan the listing for the .htaccess file, then open it utilizing your customary textual content editor.

As soon as .htaccess is open, place your cursor on the finish of the file and enter the redirection guidelines relying in your wants.

To redirect a single web page to one other web page, add the next rule:

Redirect 301 /old-page.html http://www.instance.com/new-page.html

To redirect a whole area title to one other area, enter the next code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www.)oldsite.com$ [NC]
RewriteRule ^ http://newsite.com%{REQUEST_URI} [L,R=301]

This snippet sends guests from a web page on the outdated handle to the identical web page on the new one — for instance, from www.oldsite.com/put up to www.newsite.com/put up. Don’t overlook to change the placeholders to your individual domains and pages.

Once you’re achieved, save your adjustments, and take a look at out your new redirects!


On this tutorial, I confirmed you ways to redirect a URL in WordPress utilizing two strategies, respectively:

  • Set up a redirect plugin.
  • Edit your .htaccess file.

Redirecting URLs will not be an on a regular basis activity however nonetheless pretty widespread. As such, getting it proper means customers may have a seamless expertise in your website and your search engine rankings gained’t be dropping for issues like damaged hyperlinks or duplicate content material.

Do you might have any additional questions relating to URL redirection? Be at liberty to attain out in the feedback part under!