How to Redirect a URL (3 Methods)

Redirects are an important part of search engine optimization. That’s because redirects, such as 301 redirects, 302 redirects, and others can help you maintain your PageRank and the reputation you have earned through backlinks and traffic.

Redirects are often used when moving content to a new URL, when deleting pages or when changing domain names or merging websites. But how to redirect a page or URL successfully?

In this guide, I will walk you through what redirects are, when to use them and how to use them correctly to improve your SEO.

What is URL Redirect?

URL redirect (URL forwarding) points your old URL to a new page. When anyone types in or clicks on that original URL they’ll be taken to the page you set the redirect up to instead. 

For instance, a person visits “website.com/page-a” in their browser and they are redirected to “website.com/page-b” instead.

This is very useful if we want to redirect a certain page to a new location, change the URL structure of a site, remove the “www.” portion of the URL, or even redirect users to another website entirely (just to name a few).

When to Use Redirects

You should not use redirect randomly. Also, you should avoid redirecting a page when unnecessary. Then, when is the right time to use redirects?

Let’s take a look at five real-world redirect cases.

Case 1: When You Change a URL

Maybe your original URL was poorly optimized, or you are re-organizing the folder structure of your website URLs. Then, you need to change the URL of your page. This is a critical time to use redirects and let search engines, such as Google and Bing, know that your old pages have not disappeared.

Case 2: When You Consolidate Several Pieces of Content into One

If you have decided that you have multiple pieces of content that overlap, compete for the same keywords, or all cover the same topic, you might want to consolidate them. However, you will not want to throw away the search engine visibility that these old pages might have achieved.

Once you have created your new, consolidated resource, you should set up a simple 301 redirect from each of the old pages, to the single new page.

Case 3: When You Move to A New Domain

Whether you have decided to change your business name, realized that “OhMyGoshThisIsTheCoolestDomainNameIntheWorld.com” was a little too long for anyone to remember, or you were threatened with legal action because your domain name infringed on someone else’s copyright, you might find yourself needing to move from one domain name to another.

In this case, you want to do a global redirect of all the old pages to the new pages.

Case 4: When You Conduct an Http-To-Https Migration

Some websites still run on HTTP connections. If you’re planning to move your entire site from HTTP to HTTPS, you have to be very careful. This can have devastating negative effects if the transition isn’t done properly. By properly, I mean setting up 301 redirects from each HTTP URL to its HTTPS counterpart. 

Http Redirect

Case 5: When You Have Broken Pages

Broken pages and links are actually 404 pages. You should be constantly looking for these types of errors and redirect those 404 links (broken pages) to the most relevant page on your site

3 Ways to Redirect a URL

Pro tips before redirecting a URL.

  1. There are several different redirect types and the most common redirects are 301 redirects and 302 redirects. These two redirects are used in different situations. Check the differences between 301 and 302 redirects and when to use them.
  2. Whenever possible avoid using redirects. When you have to use them, make sure to follow these best practices:
  • Avoid chained redirects: one redirect should not forward to another redirect.
  • Redirect to the preferred version of your website, using the right protocol (http or https), domain name (www or non-www) and path notation (with or without trailing slash).

Method 1: Redirect a Page or URL in WordPress (No Coding)

If you are running a website with WordPress, you can create a redirect by using one of the many WordPress redirect plugins. This allows you to setup redirects without ever writing a single line of code.

Redirection plugin allows you to setup redirects easily. Just enter your source URL and your target URL for the redirection to process. That’s all there is to make this work.

Redirect a Page or URL in WordPress

Method 2: Setting Up 301 Redirects Via .htaccess

In the vast majority of cases, a web server’s behaviour is configured using what’s called a .htaccess file.  This is a simple text file that sits in the root directory of your site.

For the purpose of implementing a 301 redirect, you will need to place a .htaccess file in your root directory (if one doesn’t already exist).  

You can create/edit a .htaccess file using any plain-text editing tools like Notepad, Sublime or Textedit – before naming the file you have created/edited ‘.htaccess’.

To explain the text that should be contained within your .htaccess file, I’ll start by using a very basic example.

For example, if you wanted to redirect a page’s URL from:

https://www.example.com/old.html

to:

https://www.example.com/new

To ensure the old page redirects to the new page, you would need to add the following code to your .htaccess file:

redirect 301 /old.html https://www.example.com/new

Here’s an explanation of what the code above means:

  • “redirect 301” tells search engines (and browsers) that your page has been moved permanently. (If you need to run a 302 redirect, change it to “redirect 302”)
  • “/old.html” – provides the old location of the page
  • “https://www.example.com/new.html” – is the new location of the page you’re telling the server to redirect visitors to.  This part of the code requires the complete URL to work properly.

Method 3: Redirect URL Using cPanel (No Coding)

By this method, you need access to your cPanel control panel. This is another method that don’t need coding.

Step #1. Access your cPanel control panel. Scroll down and find the Domains – Redirects icon, as shown in the photo. Then, click on it.

cPanel

Step #2. In the dropdown menu under Type, you can choose between Permanent (301) or Temporary (302). Make your selection.

Step #3. In the next dropdown menu, choose which domain you’re setting up the redirect for. You can choose All Public Domains if you want the update to apply to all the domains you own, otherwise select the appropriate one from the dropdown.

Step #4. Simply fill in the page you want to set up the redirect for, and the page you want it to go to. Note that in the first box, you’ll only put the last part of the URL, since the root domain name is already supplied in the dropdown menu. But in the second box, put in the full URL you want it to redirect it to.

Redirect URL Using cPanel

Summary

Hopefully, you now have a better understanding of:

  • What is URL redirect
  • When to use redirects
  • How to implement redirects

Setting up a redirect may seem intimidating at first for the non-technical website owners out there. But with several intuitive options, it’s a task you should be able to tackle on your own.

Let redirects to help you improve SEO and user experience from now on!

error: Content is protected !!