What Is A Redirect?
A redirect is a set of instructions that inform a web browser or search engine to go to a different URL (uniform resource locator) than the one initially requested. URL redirection can also be called URL forwarding. Redirects are used when a web page has moved to a new location either permanently or just temporarily.
More About Redirects
In the vast landscape of the internet, there are myriad elements that work together to ensure a seamless and efficient user experience.
One such crucial element is the redirect.
If you’re a newcomer to the world of web development or simply an internet user curious about how things work behind the scenes, you’ve come to the right place.
In this comprehensive guide, we’ll unravel the mysteries of redirects, explaining what they are, how they work, how to use them, and why they are integral to the functioning of the internet and the success of your website.
What Is A Redirect?
In its simplest form, a redirect is a set of instructions that inform a web browser or search engine to go to a different URL (uniform resource locator) than the one initially requested. URL redirection can also be called URL forwarding.
Redirects are used when a web page has moved to a new location either permanently or just temporarily.
We’ll explore more use cases for redirects in further detail soon — right after we cover the basics.
Related: What Is A URL?
Redirect Loops
A redirect loop occurs when a web server continuously directs a web browser back to the same page over and over again.
This happens when the server is set up to reroute the browser to an alternative page if the requested page is not found, instead of to a 404 error page.
When this configuration goes wrong, it can lead to a continuous redirection of the browser to the same page instead of a new one. The result is a redirection loop.
Stuck in a loop? Learn how to get out of it with our guide How To Fix The “Too Many Redirects” Error In WordPress (13 Methods).
Domain Redirects
Similar to a URL redirect is a domain redirect (or domain forwarding). This is when all the pages within a domain name are redirected to another domain name. It’s useful in cases when the top-level domain (TLD) extension for a website is changed. Such as when it’s moved from .net to the more modern .com.
Related: What Is A gTLD?
Usually when someone doesn’t specify and only says “redirect,” they’re referring to a URL redirect and not a domain redirect. We’ll do the same in this article as we focus on URL redirects specifically.
What Is An Example Of A Redirect?
Let’s talk about what a redirect can actually look like.
Say you have a page on your website that gets good traffic, you’ve linked to it a lot, and you’ve shared the link in a lot of places. But, it’s getting woefully out of date. In this example, that’s our best movies of 2019 blog post.
Instead of deleting that link and now showing an error code to everyone who clicks on it — casting mistrust and rocketing your website’s bounce rate — you can redirect it to a new page with related but fresher content. For example, an updated best movies of 2023 blog post.
What Does A Redirect Do?
A domain redirect makes the web browser send the user from the original domain name (that they requested) to another domain name (that you’ve signified via a redirect).
In practice, that means when users search for the old domain, the browser URL will change to the redirected domain.
It may sound like a bait-and-switch, but today many frequent internet users are familiar with the concept. If you’re concerned they might be alarmed by landing on an unexpected page, you can always add a disclaimer to your content introducing the updated information and explaining why they’re seeing what they’re seeing.
This may be an especially useful idea in cases where you’re updating a popular years-old article, such as a recipe or a “best of” list like the example above, where visitors may have gotten used to the older content.
When Should I Use A Redirect?
There are a lot of use cases for URL redirection:
Moving To A New Domain
As we touched on already, if you decide to change the domain name of your website, it’s crucial to set up redirects from the old domain name to the new one. This ensures that visitors using outdated links aren’t directed to an out-of-date (or broken) version of your website that bursts the bubble of their great user experience (UX).
Transitioning To HTTPS
If you’re in the process of upgrading your website’s security by moving from HTTP to HTTPS, it’s important to set up redirects that take visitors to the more secure iteration of your site.
This ensures that visitors who attempt to access the site via an unsecured connection are automatically redirected to the secure version where their data and privacy is more safeguarded.
Now that most browsers show internet users an error message when they try to access a website that isn’t using HTTPS, this is critical to maintaining a strong flow of website visitors — which is of course necessary to generate conversions and sales.
Removing Pages
When you decide to remove a particular page from your website, it’s essential to implement a redirection strategy that makes sure visitors who have the old page bookmarked or stumble upon it in an older article don’t end up at a dead end 404 page.
Merging Pages
Have multiple pages with similar content that you want to merge to create a search engine optimization (SEO) super page?
Great idea — but when you do, don’t forget to use redirects from the page(s) you’re eliminating to the consolidated one so none of that precious traffic leaks out of the funnel.
Related: What Is SEO?
Performing Maintenance
During website or content maintenance activities, a webpage might need to be temporarily taken offline.
In such cases, setting up a temporary redirect can guide visitors to a custom maintenance page, or simply another up-to-date area on your website, to make sure they’re still able to access the information and resources they need.
Providing A Temporary Response Without Reload
In case where a page needs to be displayed while information is being submitted to a website — such as a purchase, a post, etc. — a redirect can be used to serve this page to the user. This ensures that the submission page is not tampered with or reloaded, since a reload can actually resend the submission and result in errors or double transactions, posts, etc.
Why Should I Use Redirects?
Now we know when redirects are most applicable — but why is it so important to use URL redirects in all these settings?
There are really two core reasons.
The first is to provide an excellent user experience.
Imagine clicking on a link only to be met with an error message. There are a lot of resources out there and, if you’re anything like us, you’re going to go find another one.
That right there is one reason smart, timely redirects are critical. They ensure that users are seamlessly directed right where you want them to go — your freshest and most accurate content on your most updated and well-designed pages.
Then there’s SEO.
Search engines use redirects to understand which version of similar URLs is the canonical one. That means it’s the preferred one you want the search engine to crawl, index, and serve to search engine users when they enter questions your content can answer.
Redirects also minimize the chances of a user reaching an error message and bouncing off of your website. Bounces are something Google looks at when deciding the quality of your content and where it should show up in search results. You want to appear as close to the top of search results as possible to get the most eyeballs on your website.
There’s also something called a backlink which is critical to Google’s impression of your website authority and the overall SEO score of your website. If there is a link on another website that links to your website, that’s a backlink. If you remove the page to which they’ve linked and don’t set up a redirect, that backlink is gone. Backlinks are hard to build up and losing them can deal a blow to how well your site fairs against competitors.
The SEO conversation is an immense and ever-shifting one — and links and redirects are just a piece of the puzzle. If you want to learn (a lot) more about this topic, check these out:
- Mind Those URLs: How To Create An SEO-Friendly Website Structure
- Improve Your Rankings Using These 20 SEO Techniques
- On-Page Vs. Off-Page SEO: Complete Guide & Essential Tips
How Does A Redirect Work?
- When you enter a URL into your browser (the client), it sends a request to the server hosting that webpage.
- If a redirect is in place on that page, the server responds with an HTTP status code indicating the type of redirect — and the URL that’s being redirected to.
- The client then follows the instructions provided in the server message to request the URL at the new location.
- The server responds as expected with the page requested.
Redirect Types
Because redirects can be used in various cases for a host of reasons, it makes sense there would be different types of them.
Let’s go over the most common and important redirect types you should be aware of.
Permanent Redirect Vs. Temporary Redirect
There are two primary overarching categories of redirects: permanent and temporary.
Permanent redirects should be used when you have no intention of displaying the old page again, such as when deleting a page or consolidating two or more. End users won’t notice the difference here, but this type of redirect tells search engines they can forget the old URL and focus on indexing and displaying the new one.
Temporary redirects are somewhat more rare. They should be used when you just want to display a new or different page, but plan to go back to the original page at some point. This signals to Google and other search engines to retain information from the old URL so it’s ready to share that page when the temporary redirect is turned off.
Server-Side Redirects (AKA HTTP Redirects)
An HTTP or server-side redirect is when the web server where your website is hosted handles the redirect before your website loads. It’s quick and seamless on the user end.
What happens is the server receives the request for the old URL from the browser, sends back the redirect code and new URL to the browser, and the browser reads the redirect code like instructions and uses them to server up the new URL as noted.
What do we mean by “redirect code”?
So glad you asked — we can’t wait to show you.
301 Redirect (Moved Permanently)
This code communicates to servers and search engines that the relocation of a page is permanent.
It is the most effective code for passing link equity to a new page, but the returns are diminishing with each redirect so don’t treat it like an infinite authority loop.
302 Redirect (Moved Temporarily)
A 302 redirect tells search engines and servers that the URL redirection in front of them is only temporary. It says the original page should maintain its authority, though this does pass to the new URL the longer the 302 is in place, and the new one is not intended to replace it.
303 Redirect (See Other)
When the original page is unavailable or needs to be made unavailable (so it can’t reload), this type of redirect takes users to a totally different but still relevant page. It’s usually used when providing a temporary page like in the case of a purchase confirmation page, etc.
307 Redirect (Moved Temporarily)
Like a 302 redirect a 307 redirect is temporary, it’s just a slightly more modern version that works in a different way. It tells servers and search engines definitively that the new URL is temporary and the original URL will return at some point. A 302 is more ambiguous in that sense. Some sources do say that 302 redirects are the (slightly) more SEO-friendly option.
308 Redirect (Moved Permanently)
A 308 redirect signifies a permanent move, and functionally it’s a lot like a 301. A 308 is slightly more precise and clean from a technical perspective, so it may be preferred by developers. If you’re not sure which to use, 301 is probably the safer option.
For help deciding which code is best for your purposes, Yoast’s which redirect guide is a good resource.
Client-Side Redirects (Meta Refresh And JavaScript Redirects)
As opposed to server-side redirects, there are client-side redirects that happen in your website’s code. They can be implemented using JavaScript or a meta refresh tag.
Generally speaking, server-side redirects are preferred as they prevent you from needing to tamper with your code. They’re also thought to be more helpful for SEO.
This is because JavaScript redirects require the user’s browser to have JavaScript enabled, which isn’t always the case. And meta refresh redirects can be slow to load. Slow load times lead to poor UX and a lower ranking in Google’s eyes. For these reasons, we won’t focus on how to do these in this article.
What If I Don’t Use A Redirect?
Using a redirect serves a crucial purpose: it helps shield visitors from encountering error pages.
Because if you don’t set up a redirect when moving a page or changing its URL, a 404 error page is exactly what they’ll get.
When visitors encounter a 404, they are far more inclined to exit your website and find a new source than they are to go digging around to find what they’re looking for. Over time, a heightened bounce rate can even have adverse effects on your website’s SEO.
That said, you should still have a helpful, branded 404 page set up on your website for any times when something slips through the gaps. This helps keep site visitors in your brand universe and may increase your chances of keeping them in your orbit.
Further reading: How To Fix The WordPress 404 Not Found Error
2 Ways To Implement Redirects On Your Site
Feeling informed and empowered to try your hand at using redirects on your website?
Allow us to walk you through several ways to do that!
Use A Plugin/Website Builder (Beginner Friendly)
WordPress user? Us, too — we’re kind of obsessed.
One thing that we find so valuable about WordPress is how easy the platform makes it to approach what could be really technically-challenging tasks. One of those tasks is implementing redirects.
Plugins like Redirection make it easy to set up and track 301 redirects without having to touch code or tap into your server. If Redirection isn’t right for you, search the plugin directory and you’ll find tons of redirect options. Yoast is a common SEO plugin that also offers redirection features. Whatever you choose, your plugin documentation and post-installation set-up process should get you up to speed on how to use it for redirects.
And if you aren’t all that familiar with plugins yet, get primed with Your Complete Introduction To WordPress Plugins before diving in.
Related: What Is A Plugin?
Other website builders may have tooling or features that make it similarly easy to work with redirects. With Wix for example, you can manage redirects from your dashboard. HubSpot, too.
To figure out how to handle redirects in your builder of choice, Google search “how to set up URL redirects in [my website platform].”
Edit Site Code (Advanced)
Heads up: This option is intended for users who are comfortable accessing and editing their side code. Changes here can be permanent and missteps can harm and even lock you out of your website.
With that scary warning out of the way, we have to say the process of setting up server-side redirects is actually a decently-approachable method as long as you realize the risks and follow the instructions carefully.
These instructions are for implementing a permanent 301 redirect on the common Nginx server type.
First, you have to access a file within your site called “.htaccess.” You can do this by either:
- Connecting to your site with a Secure File Transfer Protocol client, like FileZilla.
- Using the file manager feature in your web hosting control panel. For example, here’s how a DreamHost client would access their website file manager.
Once you have your website files open, select the folder that has the name of your website. Inside, you should see more folders and lots of files, including once called “.htaccess.”
We recommend downloading this file, or copying all the content from it and pasting it somewhere safe, before making any changes. This way you can re-upload the original if anything goes sideways from here on out.
Now, open it to edit. Then, follow these instructions from our knowledge base to redirect single URLs or all URLs to a new location.
For even more information on setting up and troubleshooting permanent redirects, read How To Create 301 Redirects In WordPress (4 Methods).
Note that how you access and edit your website files depends on the server, its settings, and sometimes even your hosting provider. Any little deviation can make the above instructions obsolete for your website. If you try to follow these instructions and it’s not working — or you’d rather not go down this path at all — we recommend getting with a developer if you have access to one or going to your hosting provider.
Which is why it’s always important to…
Make Sure You’re Working With A Host That’s Prepared To Help
Redirects are a handy tool for keeping your website URLs fresh, accurate, and organized.
And beyond that, they’re exceedingly important for providing a great user experience and boosting your SEO so you’re more visible in search engines to people who may be interested in your products and services.
So if you’re a little overwhelmed at the prospect of handling URL redirects all on your own, we don’t blame you!
That’s why we offer several hosting plans (including managed WordPress hosting for hands-off performance) as well as SEO marketing services that you can engage to grow your website traffic and success.
At DreamHost, we aim to give you all the tools you need to make your site a success — but we’re also always nearby if you need help.