It’s been a while since we chose to go web development with the theme of our blog, and so that’s what we’re going to do today. While these are not topics that are going to have a wide-reaching appeal in as far as what’s interesting to most readers, it’s always valuable stuff and of course like any other Canadian web hosting provider a good many of our customers here at 4GoodHosting are going to be ones who are the architects and overseers of their websites.
One aspect of retaining visitors and increasing the likelihood of their interacting and participating / purchasing within your web presence is to have effective redirects. This is especially true when your site grows more complex. In addition to considering upgrading and looking at different web hosting plans, you will also have more pages, posts, and URLs to deal with.
There’s more likelihood of pages and posts that no longer exist, or you may have decided to simplify the URL structure of your content. Then there’s the scenario where you’ve purchased a domain name you want to redirect to your site, or another one where you want to switch domains altogether.
All create the need to redirect from one website to another. However, before we get into best practices for setting up website redirects, perhaps we should define what exactly a website redirect is.
What’s a Website Redirect?
A website redirect is simply when one website URL (or ‘address’ as many people know it) proceeds to point to another. Type in or clicks on the original URL and you’re automatically taken to the new page or website. Provided the website redirect is functional.
Now for the most formative developer knowing how to implement a redirect may be something you haven’t come to yet, but it’s probably something you’ll need to do eventually. Knowing how to implement a redirect will a valuable skill moving forward.
Implementing redirects on a URL or page-by-page basis is the norm, and there are a few different types of URL redirects you’ll want to be aware of. Here they are:
-
301 Redirect
A 301 redirect is a permanent redirect, and is the most commonly used and powerful redirect. That’s because it passes on nearly all of the link goodness that exists with the current domain. This type of redirect takes place on both a browser and server level. In time, the search engines will index this redirect.
-
302 Redirect
A 302 redirect is applied when you want to temporarily redirect a URL, but you still intend to move back to the old URL. A common example is when a site is being redesigned, but you wish to direct users to a different domain while that redesign is still underway.
302 redirects aren’t used very often, and much of the time as 301 redirect is a better and more practical choice.
-
Meta Refresh
Meta refreshes aren’t used very often, but they’ve been in use so long that nearly everyone will remember having seen one before. Most of us have landed on a page and been greeted with a message reading ‘The original URL has moved, you’re now being redirected. Click here if you’re not redirected in 5 seconds’. That’s a meta refresh.
Reasons You’d Put a Website Redirect in Place
Right then, after your familiarization with the types of redirects we now move to the reasons you’ll want to redirect a URL in the first place. Standard scenarios include:
-
Redirect a Subdirectory to a Page on Your Site
It’s fairly common when creating a site to decide to create your blog page on a subdomain of it. What will happen then is instead of your blog URL being ‘mysite.com/blog', it will be 'blog.mysite.com' instead. If that doesn’t work for you, you’ll then want to put a redirect in place.
The same goes for any other reason you’ve created a site or section of your site on the subdomain, and now you want to switch up the URL structure.
-
Redirect Duplicate Content to the Original Page
It’s well understood that duplicate content across your site really messes up your rankings. Larger sites have higher chances of some pages having duplicate content. Having more than one version of the same page makes it so that Google has difficulty figuring out which page should rank.
Duplicate content issues can be avoided by redirecting the duplicate piece of content to the original. In addition to making visitors less confused, this will also improve your search engine rankings as well.
-
Redirect Multiple Domains to a Single Domain
The last 10 plus years or so has seen a growing trend where people will buy up multiple domain names related to their main URL in order to protect the brand, or however else you want to define the interest.
A different suggestion with all of that is rather than just buying these domains and letting them sit have them as redirects to your main website. This works well for any of the many types of URLs purchased for this purpose; common misspellings of your existing domain name, other top level domain name extensions, etc. More often than not there’s enough benefit in redirecting them back to your main site to make it worth they effort.
-
Redirect Your Old Domain to Your New One
Sometimes individuals build out a site on a domain that wasn’t their first choice, and then end up buying a much more desirable domain later on. Whatever the reason that happens, you’ll commonly need to put a redirect of your old domain in place, and having it redirecting to your new domain. Sure, that may mean an eventual migration of then entire site, but for the initial stage it’s not too much work to set up a redirect.
-
Redirect an Old URL to a New URL
Other instances will have you needing to change the URL of existing pages and posts. That may be because you’re cleaning up your existing URL structure, or you moved some pages around and the old URL no longer makes sense.
In these scenarios you’ll want to implement a 301 redirect from the old URL to the new one. This is especially true if your older posts are already indexed in the search engines, or you have links out anywhere online.