A Step By Step Guide To 301 Redirects

Surely you have visited websites and instead of the expected pages loading, you are greeted with an error message. The ‘404 page not found’ error is a popular one. There are several reasons a website may not load, each reason gets an assigned code. These codes are called HTTP status codes.

Besides informing a website visitor that something is wrong, status codes are useful in many ways. Status codes can come in the form of redirects. For example, redirects made on your WordPress website’s frontend must reflect on your static website as well and thanks to FLATsite’s technology, this is possible if done correctly. So today, we present a step by step guide to the 301 status code.

301 Status Code

Technically, a user shouldn’t see a 301 status code, since it signals that a website has been permanently moved from one location to another. For this reason, it is known as a redirect. 301 redirects seamlessly and often without your knowledge, take you to a URL that you did not input. For example, you entered ‘myflatwebsite.com’ but when the page loads, you notice that the address reads ‘www.flatwebsite.com’.

301 redirects are not automatic, and have to be created by the website owner. Creating one tells search engines that they are no longer to look in the old location when trying to find the website, but instead, always look in the new location.

When to Use 301 Redirects

  1. Providing customers with peace of mind: when financial and personal information is to be shared, it is important that customers are reassured that their information is secure. The best way to do that is by showing the ‘https’ prefix whether it is entered or not.
  2. Maintaining domain authority: a website is a group of webpages so it makes sense that each page has the same number of website addresses in common. This way search engines can associate all your web pages with the same website, and improve your SEO ranking.
  3. Several URLs lead to one website: 301 redirects are ideal when multiple URLs can take you to the same website. Choose your canonical domain (your preferred website address) and redirect all the others to it.
  4. Domain name changes: losing a customer is not an option, so if you have changed your URL, it is best to apply a 301 redirect to your new website than frustrate and drive a customer away.

Carrying Out 301 Redirects

Now that you know when to use 301 redirects, let us look at how you can set them up. Each platform operates differently. For example, WordPress has plugins to help you, but you can also use your .htaccess file to carry out a 301 redirect. For HTML sites, you will need to input the relevant code.

FLATsite can automatically detect any properly configured 301 redirect made to your WordPress site, and publish the static version with said changes.

Server-Side Redirects

As stated before, 301 redirects are not automatic, so must be created by the website developer. This operation is carried out server-side, or by the server so that the entire website benefits from the instructions. Two server-side operations that will be getting attention today are www/non-www domains, and HTTP/HTTPS redirects.

1. How to redirect to www

301 redirects from ‘www’ to naked (non-www) domains require the following code inputted in your .htaccess file:

“RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]

RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]”

And to redirect from naked to a ‘www’ domain, enter the following code into your .htaccess file:

“RewriteEngine On

                        RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]

RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]”

Don’t forget that this is the generic code, and that you are to input your actual domain where it says ‘yourdomain’ with your URL.

2. How to redirect to HTTPS

If you are only now activating an SSL certificate, which means you will now be using the HTTPS prefix, a 301 redirect will be required. To do this via .htaccess, enter the following code at the beginning:

“RewriteEngine on

RewriteCond %{HTTP_HOST} ^yoursite.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www.yoursite.com [NC] RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]”

Again, remember to insert your actual website address where required.

301 Redirects and SEO Rankings

301 redirects affected your Google search engine results page (SERP) ranking up to 2016. This meant that Google treated the redirected site and the ‘new’ site as two independent entities whereby the old one kept any rankings it earned, while the new one had to work its way up. However, since then, Google has adjusted this to minimize 301 redirect penalties. Now, the redirected site transfers most of its rankings to the ‘new’ site.

There are instances in which a 301 redirect can help beyond customer retention. For example, when you move from HTTP to HTTPS, you should benefit from increased rankings since security is something Google looks out for when page ranking. On the other hand, if every aspect of your website is not switched over from HTTP to HTTPS, visitors to your website will be greeted with an error message. This is known as an insecure/mixed content warning.

Insecure or Mixed Content Warnings

Insecure or mixed content warnings inform visitors that while some elements on the webpage may be secure (have been switched over to HTTPS), all elements have not. These sites fail to load because it is not possible to load both HTTP and HTTPS content simultaneously. Since Google, for example, has become increasingly forceful in ensuring you take basic security protocol seriously, sites that are found to have these errors are penalized.

Summary

301 redirects are necessary when you need to guide your customers to new locations but without asking them to memorize new URLs. If done right, they do not come with penalties, and can be used to boost SEO rankings. All properly configured 301 redirects will be carried out by FLATsite’s web crawler technology, and changes displayed automatically on your static site.

  • Post category:Static Site