How to Setup URL Redirects in OpenCart (With and Without Extensions)

Every website can come at a point where there are a few broken links, some outdated content or removed pages. All of that leaves some links that need to be redirected to working pages with relevant content.

This is an exercise that fixes some holes in your site’s user experience and might even give you a slight ranking improvement. After all, it’s URLs we’re talking about, they matter.

In this post, we will talk about redirecting links in OpenCart. We’ll show you the manual way, which is easy enough for anyone to follow, and how to use an extension to configure your URL redirects.

Finding Your .htaccess File

We’ll show you how to use the .htaccess.txt file that comes with the OpenCart installation. This is a configuration file that is very important to any website.

Let’s say you have just installed OpenCart and you have a functioning store. This installation comes with an htaccess file that needs a minor modification to work.

Rename .htaccess.txt to .htaccess

To find your htaccess file, open your store files (with FileZilla for example). The file should be located in the public_html folder in your store files:

As you see, we’ve already renamed the file so you see how it should look like.

Editing Your .htaccess File

Now to enter the commands in the .htaccess file that will allow us to create the redirects we need.

Permanent website redirect

Let’s try with a permanent redirect of the entire website. To do that, open your .htaccess file and enter the following command on a new line:

Redirect 301 /

When you save your .htaccess file and try to enter your original domain, it will redirect you to the domain you have entered in the command.

Temporary website redirect

There are a lot of cases when you need a temporary redirect to a new page, such as limited-time landing pages for promotional purposes. This command lets you temporarily redirect your site to another domain:

Redirect 302 /

Web page redirect

Those commands may give you an idea of how to redirect specific pages of your OpenCart store as well. For example:

Redirect /old_product

Important: You must not enter the entire URL of the page you are redirecting, only its URI (meaning the part after .com).

Entering this will redirect to the new page of your product whenever a user tries to open the old URL.

When you are done with the commands, save your .htaccess file and reupload it to your server.

Basically, that’s how redirects are done using your .htaccess file. It’s a good measure against broken links and other pages leading to 404 (Page Missing) errors, which are looked upon with a frown both from users and search engines.

An Alternative URL Redirect Method

So much for the manual way.

Let’s check out another way, using an OpenCart extension called SEO Backpack.

You can enter and modify your .htaccess file straight from the control panel of the extension, without going through your store files.

If you go to the SEO Backpack Demo, you will notice a tab in the module settings called File Editor.

Let’s say we want to create a new redirect for the Canon camera demo product.

Go to the bottom of the .htaccess Editor and enter:

Redirect /c-cameras/p-canon-eos-5d.html

Click on Save Changes and go to the storefront. Try opening the product and see what happens.

You can repeat the same commands that we showed you in the first part of the post to setup the URL redirects you need.

This gives you a clear idea of what redirects do and how to use them to preserve the positions and traffic your old URLs are generating.

Redirect the Smart Way

Redirecting should not be abused and must be implemented with the user experience being the highest priority. The regular flow a user should have with redirects goes like this:

  • The user opens a link or enters a URL

  • It leads to a page saying “This page is no longer available. You might wanna try this one”

  • The redirect takes the user to the new page without giving a 404 error

This gives the user an expected experience and content that is relevant to their initial query. No errors, no disappointments. Google likes this as well.

Possible scenarios where you might need redirects are:

Possible Scenario #1

Let’s say you’ve been running a campaign for a discounted product, but that page is no longer available and the campaign is over. In that case, you can use that page and redirect any incoming traffic to a related product or your store’s home page.

Possible Scenario #2

You have moved your site to a new domain and you want to preserve the traffic and inbound links to the old one. In this case, use the 301 permanent redirect so that the old URL will always lead to your new site. If you ditch the old URL entirely, you will probably lose a lot of incoming traffic, especially if your store has been live for some time and has acquired a sizeable audience.

Possible Scenario #3

If you maintain a blog and have an article with a lot of views that is outdated, you can still use that traffic for a more current purpose. For instance, a new blog post covering the same or similar topic, but with relevant information. You can redirect the URL of the older, outdated blog post to the new one, so readers can get the most up-to-date info on the topic. Another win-win.


We hope you’ve learned how to use redirects in OpenCart and how to still use your old URLs for new purposes. If there’s something that’s not clear or you need help, let us know what’s wrong in the comments below!

Join 11,000+ subscribers receiving actionable E-commerce advice

* Unsubscribe any time

Trending blogs

comments powered by Disqus