Manage URL Redirection in WordPress: 3 Easy Methods

Have you redesigned your website or made revisions to its permalink structure recently?

If yes! Then you probably know that many of the links in this new design will no longer work because they point at pages with old URLs. So, the biggest challenge you’ll face is updating the URLs of all your pages and posts to reflect their new locations.

Luckily, there’s an easy solution available: WordPress Redirects! It lets you keep your domain name intact, ensuring users can quickly find what they’re looking for in their new location without any 404 errors popping in.

Let’s dive deep into how WordPress has offered such relief!

What is URL Redirection?  

URL redirection, also known as URL forwarding, is a technique to give more than one URL address to a page, a form, or a whole Web site/application. HTTP has a unique response, called an HTTP redirect, for this operation.

If you make changes to a domain or page, it is essential that you also adjust the permalink structure! Otherwise, people will have difficulty finding content because old links won’t be redirected properly. They’ll end up being left behind in search engine results when they try looking for information on an outdated site!

For example, if “www.example-site1” replaces “www.example-site2“, visitors who link back to www.example-site1 might become frustrated and leave after discovering their link is broken or non-existent. They’ll find a 404 Error Page instead! This could severely hurt organic traffic over time as well as cause confusion for anyone.

It would be like moving from one house to another without updating address information for mail. Therefore, important documents could end up missing their delivery!

When should you Redirect the URL?

URL redirection is a great way to keep your visitors on track. If there are any broken links or 404 errors, the user will be directed without interruption!

404 Error Page
404 Error Page

There are many reasons for using URL redirects, and these can be the following:-

  • When your site is on maintenance or downtime.
  • You have changed your domain from HTTP to HTTPS.
  • You’re changing domains completely.
  • Your content has been updated but has not yet been published with its new page/post URL.
  • Change the permalink structure of your website.
  • You are moving or deleting content.
  • Updating sites after changing web hosting providers.
  • Migrating websites, etc.

Types of URL Redirection

There are several types of URL redirection, mainly sorted into three categories:-

  1. Permanent Redirection
  2. Temporary Redirection
  3. Special Redirection

Let’s suppose you find yourself in a situation where your cat is constantly snooping around the kitchen and stealing food, and it might be time for some redirection. One way to do this is with what we call “Permanent Redirections,” which are usually something like an object or strategically placed rug that will prevent your cat from going into those rooms again. Temporary Redirections can include just placing their favorite toy up high enough so they cannot reach it when they jump on furniture; these types of things don’t need to last forever, either! Lastly, Special Redirections refer to situations involving scratching posts or litter boxes; sometimes, there’s more than one type required!

1. Permanent Redirections

  • 301 Redirect (Moved Permanently) – 301 redirects are the most common type of “redirect” you’ll be dealing with as a WordPress user. This is because they tell search engines that content has been permanently moved and passes between 90-99% link juice, ensuring your new page gets at least some credibility from previous pages’ links to it. In most cases, 301 redirections will result in the search engine passing on most of its authority or link juice (page value) to your updated page.
  • 308 Redirect (Permanent Redirect) – A 308 redirect is a permanent type of redirection. It doesn’t affect SEO, but can use it to pass link juice and page authority. Most professionals will opt for a 301 because it has the best effects when dealing with search engine optimization (SEO).

2. Temporary Redirection

  • 302 Redirect (Found) – This temporary redirect informs search engines that the page has moved but not permanently. It does not pass on link juice as a 301 redirect does. More importantly, it allows for necessary links to be found and followed to continue your work until you move all of them over again!
  • 303 Redirect (Redirect) – The 303 temporary redirect prevents users from refreshing or bookmarking pages that are storing data (payment forms, landing pages). This way, they can’t re-submit a form after hitting the “back” button in their browsers. These types of redirects don’t influence SEO.
  • 307 Redirect (Temporary Redirect) – A 307 redirect is similar to a 303 redirect in that it should only be used for a temporarily moved page. However, a 302 redirect is usually the preferred method.

3. Special Redirection

  • 300 Redirect (multiple choice) – The HTTP 300 Multiple Choices redirect status response code indicates that the user should choose one of many possible responses to a request. There is no standard way to pick from these choices, so this status isn’t usually used very often.
  • 304 Redirect (not modified) – The HTTP 304 Not Modified response code is an implicit redirection to a cached resource. It indicates that there is no need to retransmit the requested resources.
  • 404 Redirect (Not Found) – If a URL links to a page that no longer exists or was transferred to another link that moved, your visitors may encounter a 404-page error.
  • 410 Content Deleted – The 410 Content Deleted redirection Type to tell users and the search engines about the content you’ve deleted from your website
  • 451 Content Unavailable for Legal Reasons – Can’t display the content in some countries or for legal reasons? Use the 451 redirection Type to provide accurate information to the user.

Methods of URL Redirection in WordPress

There are a few ways you can redirect URLs in WordPress. You can do it with or without plugins. If you’re more comfortable working with a plugin, there are many URL redirection plugins available for WordPress. If not, you can use the .htaccess file or function file of your theme to manually redirect URLs as well.

1. Redirect URLs using .htaccess file

As we discussed earlier, there are different types of URL redirection. 301 redirects are used when permanently forwarding one URL to another, while 302 redirects are temporary. That means search engines will default to the new location and index correctly. This type of URL redirect prevents you from losing your search engine page ranking.

To use this method, you should first check whether your .htaccess file is editable or not. If it’s not, don’t hesitate to get in touch with your hosting provider to grant permission to edit the file. Once you have permission, locate and download the .htaccess file from either cPanel or through FTP. Alternatively, you can use the WP Htaccess Editor plugin to edit the .htaccess file. Make sure to take a backup before making any changes!
Open up the .htaccess file and write one of these codes at the top:

Redirect 301 /current-page.html http://www.yoursite.com/new-page/

This redirect will change your URL from http://www.yoursite.com/current-page to http://www.yoursite.com/new-page (you’ll need to replace the placeholders with your site’s information). While adding your redirects, remember that you can only have one per line in the .htaccess file.

2. Redirect URLs using the function.php file of your theme

You can also redirect a URL using the functions.php file in a child theme, which is ideal for customization because your input remains unchanged when you update your themes.

  • Locate the functions.php file in your child theme using an  FTP or a cPanel.
  • Suppose you plan to redirect your old site to a new one, and open functions.php with a code editor. Add WordPress’ very own wp_redirect function by adding the following lines to the end of the code.
function wpv_redirection(){ 
    wp_redirect("http://www.your-site.com/new-url", 301);
    exit;
}
add_action('template_redirect', 'wpv_redirection');
  • You can also create complex conditional URL redirections, such as 404 pages, logged-in users, or any specific page condition.
  • The wp_redirect function can be used to redirect a single URL. You can also use the wp_redirect function to redirect specific slugs to a new URL.

3. Redirect URLs using WordPress Plugins

Several plugins provide you the ability to redirect your website. For this demonstration, we will use the Redirection Plugin as an example of how easy it can be for those who don’t want to touch their WordPress core files.

1. Redirection

Your first step will be to install and activate the Redirection plugin in your admin dashboard. Once you have done that, get started with configuring it by going to Tools -> Redirection. You can locate this configuration page via the “Start Setup” button on the welcome screen. Fill out all the necessary information and complete the setup wizard. Once done, you can start using it.

WordPress Redirection Settings
WordPress Redirection Settings
How to Set Up a New URL Redirection Manually?

To set up a new URL redirection manually, click on the Add New Button. Now you’re ready to input the source and target URLs accordingly. Just click on the “Add redirect button”. You can use the Gear icon to apply more advanced redirect settings.

WordPress URL Redirection Settings
WordPress URL Redirection Settings

You can Import / Export your redirects. for example. Export old URLs from the old website and then use the plugin for the new website to import the list.

At the bottom of the screen, under the Export button, you will find menu items that allow exporting everything to CSV files or Apache .htaccess rules and Nginx rewrite rules files or redirection JSON files.

You can use this powerful plugin to do the following:

  • Create different types of WordPress redirects, including permanent and temporary.
  • Manage 404 errors on your website
  • Import or export redirects and create groups, so they’re easier to manage!

This plugin could make your life a whole lot easier, too.
It looks like this is a super cool and helpful plugin to have. However, there are other plugins available with similar functionality.

2. Safe Redirect Manager

The Safe Redirect Manager plugin allows you to create redirects from one page or website address to go somewhere else. All this can be done in the WordPress Tools menu, where all of your information is stored for easy access. You’ll also have a selection of HTTP status codes so that it’s suitable for any type of need!

3. 301 Redirects – Easy Redirect Manager

This plugin can help you create 301 redirects, 302 redirects, and 307 redirects for your WordPress site to improve SEO and visitor experience. You can redirect old URLs to other similar posts based on title, post types, categories, and tags, or create a new custom URL.
It also offers a 404 error log that allows for the tracking of errors to ensure your site is up-to-date with functioning pages. You don’t need to do a manual audit every time.

4. Yoast SEO

Yoast SEO Redirect Manager helps you to manage or create your redirects. It prevents users and search engines from getting lost, and it even makes automatic URL redirection when content changes or gets deleted! Which is great for users, search engines, and your workflow!

5. RankMath SEO

Rank Math SEO is a powerful URL redirection plugin for WordPress that helps you cloak affiliate links, fix broken URLs, and redirect hundreds of pages with just a few clicks.

What is a Server-Side Redirect?  

Redirecting your website can be a daunting experience. If you are not careful, the wrong redirect could lead to traffic and search engine rankings problems. Whether you need to redirect your website from HTTP to HTTPS or whether it’s the other way around- switching between www and non-www domains can be a hassle. Fortunately, there is an easy solution for this problem: 301 permanent redirection at the server level!

How to Redirect URLs from HTTPS to HTTP?

If you’ve installed an SSL Certificate and successfully migrated your site to the new HTTPS domain, then do not forget about creating a server-side redirect.

To redirect HTTP to HTTPS using your .htaccess file, first locate and download the .htaccess and then you’ll need to enter the following lines at the top:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yoursite.com [NC]
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]

How to Redirect URLs from www to non-www?

If you choose to redirect your pages to non-www URLs, it’s a good idea to apply the changes at the whole site level in order to avoid page duplication and poor user experience. This means that any search engine optimizing work will have its maximum impact on all of your web pages instead of just some, like URL targeting alone.

To redirect www to non-www using your .htaccess file, first locate and download the .htaccess and then you’ll need to enter the following lines at the top:

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

If you’re looking for a plugin that can help you do this, we again recommend “Really Simple SSL“. This plugin enables you to redirect HTTP to HTTPS and www to non-www and vice versa by adding the correct code for you.

How to Manage Redirections for a Domain in WordPress?

If you’re moving your WordPress site to a new domain, there are certain things that you should keep in mind for SEO purposes. First, you can perform DOMAIN REDIRECTs after backing up and then migrating the content over.

To perform this redirect using your .htaccess file, first locate and download the .htaccess file of the new domain, and then you’ll need to enter the following lines at the top:

#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.newurl.com/$1 [R=301,L]

One way to make your site more visible to search engines is by avoiding or minimizing the use of redirecting URLs. These are links that can replace one website with another without passing through a page hosted by you.

Redirects can adversely affect how well your site ranks in searches because they do not come from an original source and instead serve as a link pointing away from your content rather than towards it.

Other Ways of Redirections?

HTML Redirections with the <meta> element

With a META Tag, you can easily redirect your site. This is done with the http-equiv attribute which provides an HTTP header for the content of the tag’s value.

<head>
    <meta http-equiv="Refresh" content="0; URL=https://example.com/">
</head>

JavaScript Redirections via the DOM

You can redirect your current page using JavaScript too. You can do it with the location object. Just type in “location=newURL” and hit enter!

window.location = "https://example.com/";

Wrapping Up

Have you ever wanted to redirect a URL? If so, then we hope this article has guided you in the right direction. It would be best if you considered redirecting URLs whether you’re planning to move your website, change the website structure, fix some broken links, or improve the site’s SEO.

Finding a suitable redirection method among those listed above can depend on various factors such as skill level or what exactly you are looking to accomplish with it.

We hope you got all your answers on how to handle URL redirection in a WordPress site. Try out the methods listed above, and let us know about your experience in the comments below.

Checkout:  Save Elementor Pro form submissions to the database

Leave a Reply

Your email address will not be published. Required fields are marked *