Monday, November 27, 2017

How to Create Redirects with WordPress

5/5 (3)

Broken external links, outdated content, and 404 dead-ends are not conducive to a great user experience.

Too many of them, and you can wave goodbye to your audience as they run away bravely. Who's going to stick around and check out a site that doesn't deliver? No one, that's who.

So, you must fix these problems, right?

How do you do it? Luckily, that's the easy part. You can use a function known as redirection to not only fix the issues above but to also make sure you're still getting all the benefits of that old content.

Before we get into how to create a redirect, let's first take a closer look at:

  • what redirects are
  • types of redirects and how they can help you
  • when to redirect
  • when not to redirect.
  • To make the most of the redirects, you must know the right way to implement them and when to apply them.

    Otherwise, you run the risk of harming the user experience.

    Understanding Redirects

    In the simplest terms, a redirect is an instruction telling the server to send a visitor to a different page than the one they clicked on.

    Let's say you deleted a blog post entitled "5 New Windows Features" because it referred to Windows 7 and no one wants to know about Windows 7 anymore.

    However, the post and address have been indexed and they keep showing up in the search engine results pages.

    So, when someone clicks on the link, they see a 404 dead-end page. With a redirect, though, you can tell the server to send the visitor to a different page when they click on that link.

    The best option is a related article, like "5 New Features in Windows 10", which is probably what they were looking for in the first place.

    You benefit twice from this approach.

    First, you pass on the link juice of the original article to the newer article, which will help its rank increase.

    Secondly, you also pass along the traffic. In other words, instead of those visitors clicking the back button or closing the tab, they'll stick around because you offered them what they were looking for.

    The redirect approach ensures you won't waste the organic traffic being driven to the original article, but also makes sure that traffic sticks around.

    wordpress theme

    wordpress theme

    Types of Redirects

    The most common types of redirects are:

  • 301 server redirects
  • 302 server redirects
  • Meta refresh browser redirects.
  • We've included meta redirects because they are still in use. However, if you want to offer your visitors a wonderful experience, we recommend staying away from them.

    In fact, just pretend we never mentioned them.

    What's a 301 Redirect?

    The 301 redirect is the most commonly used and the one you'll be using in most cases.

    It's a permanent redirect, which tells browsers and web crawlers that the URL will always redirect to the new address.

    Forever and ever.

    When a search engine comes across a 301, it automatically replaces the original URL with the new one. It also passes on the link juice, so the new URL will show up in the same SERP position as the old one if the content is similar.

    What's a 302 Redirect?

    A 302 redirect is temporary. When a search engine or browser comes across one of these, they won't replace the original URL or pass the link juice onto the new one. This occurs because the code in the 302 redirect is telling the search engine that the redirect is temporary, and the situation will revert to normal in the future.

    An example of a situation when you'd use a temporary redirect is when you have a page with inaccurate information. Maybe you're getting a lot of negative feedback because of it.

    Instead of taking the page down completely, just use a 302 redirect to a related page until you get the information sorted.

    This way, you won't lose the link juice or traffic but will have time to fix the problem.

    What's a Meta Refresh Browser Redirect?

    A meta refresh redirect is the type of redirect where the browser shows the visitor a message saying, "you will be redirected in X seconds." That's why we never use them. They make for a horrible user experience.

    And that's all we're going to say about them.

    When to Use Redirects?

    Here are the situations when a redirect makes sense:

  • You've created updated content and want to redirect visitors from the old content to the latest content;
  • You've deleted outdated content and want to send visitors to the new content;
  • You've changed the permalink structure of your website and need to send the old URLs to the new ones;
  • You are updating an existing page and want to send people to another page while you do so.
  • wordpress plugins

    wordpress plugins

    When You Shouldn't Use Redirects

    Every redirect will slow down your site.

    It won't necessarily be noticeable, if you only use redirects to point from old to new content, for example. However, if you start using redirects for every menu item, it will slow your site down to a crawl.

    So, a good rule of thumb is only to use redirects when there is absolutely no other choice, and the benefits outweigh the drawbacks.

    How to Create Redirects

    So, now let's look at how you can create redirects in WordPress. We'll be looking at how you can do it manually, using .htaccess or PHP, as well as automatically using plugins.

    How to Create a Redirect with Htaccess

    The first step is to create a backup of your .htaccess file. One wrong character and you might find your website no longer works at all. So, always create a backup to restore to a previous point if something does go wrong.

    If you are using an Apache server, you can create a 301 redirect in the .htaccess file with a simple line of code that includes the old address and the new address. It should look as follows:

    Redirect 301 /outdatedcontent.html http://www.yoursite.com/updatedcontent.html

    Similar code can be used to redirect whole folders. If you want to redirect your website, then use:

    Redirect 301 / http://www.yourupdatedsite.com

    To check if you've done it right, just go to the page you want to redirect from, and you should be taken immediately to the new page.

    How to Create a Redirect with PHP

    Since WordPress uses PHP, most of the scripts you integrate with this CMS will be PHP as well. Therefore you should use PHP if you want to create a redirect from a PHP page that is not part of your WordPress installation.

    To create a redirect, include the code below in the header:

    <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.yournewwebsite.com"); ?>

    The code must be at the top of the page for it to work properly. You must also include the 301 Moved Permanently line because that's what tells the search engines that it is a 301 redirect.

    How to Create a Redirect Using Plugins

    You can certainly use the manual approaches to create redirects.

    But why would you when you can use a plugin?

    There are quite a few great free plugins that will allow you to create redirects with absolutely no hassle. And without worrying about making a mistake that could break your site.

    Redirection

    Redirection is one of the most popular plugins of its type in the WordPress Plugin Directory as shown by the over half a million active installs it boasts. It also has a rating of 4.2 stars out of a total of 5 based on reviews from more than 300 users.

    When you activate Redirection, you will see a new settings page has been added to your dashboard. You can access it via Tools > Redirection.

    To create a redirect, create a new group in the Groups tab. You'll be able to choose from WordPress, Apache, and NGINX redirects.

    If you're not sure which to choose, just go with WordPress.

    Go back to the Redirects tab and go the Add new redirection form, where you can set up the rules. Note that this plugin only creates 301 redirects.

    Other useful features include:

  • The ability to download redirects in various formats
  • A log of redirects
  • A log of how many 404 pages have been served up
  • The ability to import rules in .htaccess or CSV formats.
  • Redirection is a great plugin for anyone who needs to create redirects without the hassle involved in doing it manually.

    It's also the best choice if you want to keep a record of all the redirects and how many times people have landed on 404 pages.

    Simple 301 Redirects

    This is the second most popular redirect plugin because it delivers. Over 200,000 sites use the plugin, and nearly 120 users have given it a 4.3-star rating.

    These high figures show that the plugin works well. It makes creating redirects simple.

    It's a simple plugin, and when activated, you will find a new screen in your admin dashboard. You can get it via Settings > 301 Redirects.

    The new page has a form, where you will create manual redirect rules. You will have to do them one by one. To make life easier, you can download the plugin add-on so that you can import your rules in CSV.

    Simple 301 Redirects is an excellent choice for anyone looking for a light-weight plugin that doesn't come with a ton of bells and whistles to get lost in.

    Eggplant 301 Redirects

    Eggplant 301 Redirects isn't quite as popular as the previous two. In fact, not a lot of people seem to know about it considering only 40,000 sites use it. It does have great reviews, though. Over 30 people have rated it 4.3 stars.

    This plugin is excellent, though.

    When you install it, a new page will be added to the dashboard. Access it via Settings > EPS Redirects.

    The page has three tabs as follows:

  • Redirects – a form to manually enter your rules;
  • 404 – this tab doesn't work for the free version of the plugin. Upgrade to the premium version for a log of 404 hits;
  • Import/Export – in this tab, you can import a list of redirect rules in CSV format, or you can export your existing list. You can also download a sample CSV file to help you figure out how to set up your file.
  • While the two previous plugins have similar features, Eggplant does offer two unique options.

    First, you can create 302 redirects and not just 301 redirects, which is something neither Redirection nor Simple 301 Redirects offer.

    Second, the form where you create redirect rules has a menu to help you out and ensure you avoid any mistakes when entering the destination URL. This way you can be sure you won't be sending your visitors to a 404 page.

    Eggplant 301 Redirects is an excellent choice for websites that need to use 302 redirects and not just 301s. It's also a good choice if you want to make sure you don't make any mistakes when typing out the new URLs, which would send your visitors to a 404 page.

    Auto Refresh Single Page

    Though not a redirection plugin, we included it because it allows you to refresh pages with live feeds using a more elegant approach than a meta refresh.

    When you activate the plugin, you will find a meta box has been added to your page editor. Enter a number in the box, which stands for the number of seconds between page refreshes.

    Redirects are a powerful tool, both for SEO purposes and to improve the user experience. To ensure you offer the best experience while taking full advantage of SEO, you need to understand redirects and how they work.

    Hopefully, now you have a better understanding of when and where to use redirects to make the most of them. Just remember to weigh the benefits against the drawbacks if you aren't sure whether a redirect is right or not.

    Related Posts

    Beginner's Guide to WordPress Redirection or How to Deal With Annoying 404's

    How to Use Redirect 301 Correctly on Various Server Platforms

    7 Amazing WordPress Plugins That Actually Help You Run Your Business

    6 Down and Dirty Secrets for Great SEO on WordPress


    Source: How to Create Redirects with WordPress

    No comments:

    Post a Comment