If you’ve moved in the past, you’re probably familiar with how your local post office handles your mail. You give them your new address, and they automatically forward all your letters, bills, and (ugh) junk mail to the new location.
When you want to move something in your online store, it doesn’t seem so simple. There’s no post office to notify, no sticker to put on your page that directs traffic to a new location. It’s much more complicated… right?
It is, in fact, very easy to move things around in your online store — if you know how. If you want to learn to redirect traffic from one page of your site to another, this post is for you. We’ll be discussing how to use URL redirects to shuffle traffic from one page to another. It takes just a little time and effort, and you won’t even have to call the post office.
Let’s explore how eCommerce redirects work, when you should use them, and how you can set them up on your site.
A URL redirect does exactly what it sounds like: when you enter a URL into your browser or click on a link, it directs you from your initial location to a different destination.
The way redirects actually work is a little more complex. You’re probably familiar with the “404 not found” error, right? Well, there are similar codes, like that 404, that tell your browser what the status of a redirected URL is — whether it’s gone forever or just temporarily missing — and what to do next.
The currently used/recommended redirect codes are:
- 301 — permanent redirect (the first URL isn’t coming back)
- 303 — see other (you’re being moved to a new URL, just wait a moment)
- 307 — temporary redirect (the page you want has temporarily moved to this location)
There are a few other redirect options, including 302 (temporary redirect) and 308 (permanent redirect), but the former has been phased out and the latter has not yet been adapted.
99% of the time, your store is going to need a 301, or permanent, URL redirect. As such, that’s what we’ll be focusing on in this guide: when you might need permanent URL redirection, and how to set it up.
When your online store might need a redirect
Let’s say you have a popular product. Over time, its page accumulates a lot of links from other sites. But after a few years, you need to replace this product with a new version.
You don’t want to lose those links, or the potential customers that come with them. But you do need to create a new page for the new version of this product, so using the same URL is out of the question.
This is the exact type of situation that a 301 redirect was created for!
With a 301, or permanent, URL redirect, you can send everyone who visits the link for your old product page to your new one automatically. Any potential customers who click the link will almost instantly land at your new page, without seeing any 404 errors or waiting more than a second or two.
You might need a redirect in a variety of other situations, too, including:
- When a product has been removed and you want to direct traffic to a similar item instead
- When you’ve removed a special landing page (for a sale, contest, etc.), and just want the traffic going to your homepage
- When you’ve consolidated multiple product pages into one (for example, with variations) and are left with multiple outdated URLs
- When you’ve changed your store’s URL structure entirely
Basically, if you’ve removed a URL and it’s never coming back, it’s time for a redirect. That traffic has to go somewhere, after all.
When you need a redirect, and when you can go without
At this point you might be wondering “do I always need to redirect my URLs? What if I make a typo and change it right away?”
Redirects are only crucial if the initial URL has been widely visited, bookmarked, linked to, or referenced in external materials (for example, in marketing or other promotions). While a 404 certainly isn’t a good experience for your store’s visitors, one or two potential dead links is sometimes better than spending several minutes of your time setting up a redirect no one will use.
So if you make a typo in a product page URL and immediately fix it, don’t worry about the redirect. But if you make a typo and only catch it a few weeks later, you should probably create the 301.
One final note: some platforms, including WordPress, will attempt to redirect any changed URLs automatically. This likely won’t apply to any major changes (for example, changing the structure of your permalinks in WordPress after publishing a few dozen pages), but it’s worth looking into the next time you make a minor URL alteration.
How to implement a redirect for your eCommerce website
Now you know what redirects are, and when you might need one. You’re ready for the next big step: learning to implement one.
There are multiple ways to implement a redirect for an eCommerce website, and they vary both by platform and hosting environment. We’ll cover some of the most common here, starting with how you can set up redirects if you’re running WooCommerce.
Redirects with WooCommerce or WordPress
As mentioned above, WordPress will attempt to automatically handle basic URL redirections for you — for example, if you change the title of a product page in WooCommerce, and with it the permalink. However, major redirects aren’t handled, so anything like a category change or alteration in permalink structure will need to be handled manually.
If you’re not opposed to adding another extension to your WooCommerce store, you can set up 301 redirects in a matter of moments by installing one. Redirection is one of the most popular (and free) plugins for creating URL redirects within WordPress.
Just enter the source (old) URL, the target (current) URL, and click “Add Redirection.” That’s it — you’re done.
Redirection also keeps track of your store’s 404 (“not found”) errors, which can alert you to potential redirects that might need to be created. It also has built-in statistics, so you’ll also be able to see how many times your redirects have been used.
Redirects for self-hosted platforms using the .htaccess file
Don’t want to add another plugin, or are you not using WooCommerce? No problem.
If your store is self-hosted and you have access to your server, you can set up URL redirects by editing your .htaccess file. This is a simple file that applies global configuration settings to your server. It’s also where you can set up URL redirects by hand.
You can check for this file by accessing your server’s public_html directory via FTP or File Manager. If you don’t see a .htaccess file, you can create one using your text editor of choice. Name it .htaccess (with no extension) and upload it to public_html.
Having said that, you should always make sure you don’t already have an .htaccess file first. If you’re using WordPress, you should have one already. When you open your File Manager, look for options below that allow you to “Show Hidden Files” or “show dotfiles”:
Either way, once you create or open your .htaccess file, you’ll be ready to add your first 301 redirect. The easiest route will be to edit it via your server’s File Manager (using the built-in Code Edit option, if available), or you can always open it with your local text editor of choice.
WARNING: Always back up your .htaccess before making any edits, especially if you are unfamiliar with this file.
When you add new redirects, they should be formatted like this:
# Place your comments here
Redirect 301 /oldurl.html http://www.site.com/newurl.html
Each new redirect should be on a new line. Comments can be added, and should be marked by a pound sign (#).
Save your file, upload it if necessary, and test the redirect in your browser. If the redirect works, fantastic! If something seems out of place, take a look at the example above and give it another shot.
Note that if you’re doing this process for a WordPress site or WooCommerce store, your redirects should be placed above the WordPress code, as shown above. (Hat tip to Damien for noting the importance of this in the comments!)
Some store owners won’t have access to .htaccess, including:
- Those who use a hosted eCommerce platform
- Anyone not on an Linux hosting environment, i.e. using a Windows server
- Clients of certain hosts who have blocked the ability to access, edit, or create this file
If you’re in one of these situations, you’re not out of luck. However, you’ll probably have to consult your platform and/or your host to find out the best way to implement 301 redirects.
In many cases, hosted platforms have an option for URL redirects built right in, although it might be a little difficult to find. As for you Windows users, give this resource from Microsoft a try — it walks you through creating redirects with IIS.
The danger of not implementing proper redirects
If you discontinue products frequently, this redirection thing might sound like a lot of work (and it is). So you might be thinking “can’t I just let those links 404? Won’t my visitors just go to my homepage?”
There are two really, really big problems with not setting up redirects for removed URLs:
- It creates a poor experience for your visitors, which over time can make the situation…
- … absolutely terrible for your store’s search engine optimization (SEO)!
Think about this: if you search for a product, click a link from Google, and get a 404, you’re probably going to be annoyed. You might stay on the site and look for the correct link… or you might leave immediately and try another site instead.
This doesn’t just mean a loss in sales — it also means a loss in rankings. User behavior has a compounding effect on your site’s SEO. Google notices when users do U-turns, and it doesn’t want to highly rank the sites that cause them.
So if you have a lot of old links that don’t redirect to new ones, and the visitors coming from search are constantly getting annoyed and leaving, your rankings are going to slip.
While Google says that 404 errors won’t impact your search engine rankings outright, they can certainly have a snowball effect over time. And more importantly, you don’t want to upset your potential customers. So it’s best to take the time and set up redirects where they’re needed, as soon as they’re needed, rather than face the consequences of slipping in the rankings.
Set your customers straight with URL redirects
There you have it — your own virtual equivalent to the post office’s address forwarding. Now you’ll be able to get your visitors moving in the right direction when they visit your site, no matter how old your URLs are or where they used to point.
Do you have any questions about implementing redirects in your store? Any recommendations you’d like to add for our readers? Let us know in the comments below, we’re always eager to hear from you.
Header image credit: DaveBleasdale