How to Create a 301 Redirect in 3 Easy Steps

Rimuri
By -
0
Have some of the Erzedka Friends changed their website address or URL? Usually we change it for some reason. One of them is wanting to update from the old URL to the new URL. But if you do an update, website visitors may be confused about finding the intended destination page because of changes that were not notified in advance.

Therefore, it is necessary to redirect or redirect from the old page URL to the new page URL. The trick is to use Redirect 301. In this article, you will learn what a 301 redirect is, why you should do a 301 redirect, and how to do a 301 redirect.


What are Redirects?


How to Create a 301 Redirect in 3 Easy Steps

Before knowing about 301 redirects, it's a good idea if Erzedka Friend understands about redirects first. Redirects are a way for your website to send a quick message to your readers' browsers and notify them that the page they wanted to visit has been moved. So that the browser that we access can automatically redirect to a new page.

There are several types of redirects that are accompanied by a special code. This special code varies depending on the status code that affects the method the program uses to access the new location. The types of redirects include redirect 301, redirect 302, redirect 303, redirect 307 and redirect 308. In this article, we will discuss in full about 301 redirects. Listen to the bottom, friends!

What are 301 redirects?


Redirect 301 is a redirect command used to notify search engines that a page has been moved permanently to another page. This means that the URL of the website and all of its content has permanently moved to another location. So you can use this redirect if you're sure you won't be using the old URL again.

Redirect 301 refers to the HTTP status code for this type of redirect. In most of the cases, 301 redirects are the best method to implement redirects on websites. A 301 status code is usually the safest first choice for redirects to maintain SEO.

This is because 301 redirects help forward all the links and ranking authority that the old URL has collected to the new URL of your website. This way, previous SEO efforts to improve search rankings on search engines are not lost..


When to do 301 redirects?


301 redirects are used for the purpose of telling visitors to be redirected to a new URL, preventing dead ends on a website and to maintain link equity. In general, 301 redirects are executed when you want to move all content that has SEO value to a destination URL.

The use of this 301 redirect is done when:

  • Website redesign: You can do this redirect when you want to redesign or overhaul your website. This change makes some URLs change so you need to use a redirect.
  • Content Has Expired: You can give instructions to visitors to redirect to a new page when the content has expired.
  • Merging two websites: If you want to combine or merge two websites into one website, you can use a 301 redirect.
  • Changing permalinks: It's not uncommon for website owners to change permalinks. Permalink is a URL that follows the domain name with additional information such as year, title, category and so on in a particular page. One thing that can be done to change the permalink is to do a 301 redirect.
  • Renaming a post: Sometimes WordPress can handle this case but not always or according to the wishes of the website owner.
  • Changing the new CMS: For example, you want to use WordPress
  • Migrate to HTTPS: When you want to change the website protocol, for example, from non HTTPS to HTTPS.

When Should you Consider using a 301 Redirect?


When Should you Consider using a 301 Redirect

Not always 301 redirects can be used every time. It is generally not recommended to use 301 redirects when caching as this can lead to unexpected results, as in the following example:

1. Geographic Targeting


  • If Geo-IP redirects prohibit sites from being naturally crawled, then users may be redirected incorrectly.
  • While 301 redirects are cached by default in browsers, once a user is redirected once, they are always redirected to the same URL.
  • If the user isn't always in the same location at one time, this redirect will tie them to the first region where they visited the site.
  • If bots and crawlers have servers in multiple countries, they will follow IP redirects based on their location, and may be unable to crawl other variants of the website. As a result, such geo-targeted redirects are considered bad practice.

2. Device targeting


  • Redirects to forward users to device-specific URLs must be temporary and not cacheable.
  • Users may prefer the desktop version of the URL and will not be able to access it if a cacheable redirect is implemented.

3. A/B testing


  • Google recommends using a temporary redirect for A/B tests because it will take effect for the duration of the experiment.
  • The original URL should be stored in the index rather than the test page.

How Long Does a 301 Redirect Last?


According to Google's Senior Webmaster Trend Analyst, John Mueller recommends 301 redirects persist for at least one year after they are implemented.

This is because Google can take some time to notice that the page has permanently moved to the new version and there may still be visitors to the old version if there is still a link to it. John says that there is no problem with maintaining a 301 redirect permanently and perpetually, but this is not recommended.


Why do you have to do 301 redirects?


Why do you have to do 301 redirects

There are several reasons why you need to do a 301 redirect, especially for those of you who are marketers who have an online business website. The reason is as follows:

1. To associate common web on one URL


This redirect is used to maximize domain authority. This is because redirects can ensure website SEO is as accurate as possible, help migrate content and help visitors and search engines find your website faster.

2. Associate common web conventions with a single URL


301 redirects or 301 redirects help you bind common web conventions (http://, www and others) in one URL. This is useful for maximizing domain authority. In addition, this redirect can ensure that the SEO that you apply is as accurate as possible. This can help in migrating website content and help audiences and search engines to find websites faster.

3. To change the website name for the sake of rebranding needs


When a brand decides to change its name, the website name automatically changes too. 301 redirects are integral to retaining incoming links to original URLs on new domains being migrated. And the most important thing is to notify visitors and redirect visitors to the new website.

4. Website traffic from other URLs belongs to the same company


Brands sometimes purchase domains that have a name or subject similar to their brand in order to generate more search traffic to their website. Transfers are also needed to ensure that the brand's original domain retains search authority.

5. Quick Fix


For example, you accidentally made a mistake in your post so you posted a broken link. To fix this, you can use a 301 redirect using the .htaccess file.

6. Ad tracking


If you have a banner ad, you can track the response by using the URL in the ad. By implementing a 301 redirect, you can get traffic obtained from these ads.

How to create 301 redirect in HTML?


There are several steps to do a 301 redirect, namely by

1. Inserting a 301 redirect instruction into the old URL header


If the old page uses PHP, Java, or another programming language, you can include a 301 redirect instruction in the header of each page. This will direct traffic to the new location you included in the instructions. 

Make sure you enter the URL of the destination page on the old URL page so that visitors will automatically be redirected to the new URL destination.

2. Using the .htaccess file settings


In order to use this step, you have to make sure that you have access to the Apache server and configuration so that you can use the .htaccess file.

.htaccess is a plain text file that you can use to make configuration changes that affect how the website server delivers your page. The website server in question is a Linux / Apache web server. You can run Apache if the hosting package used is a Linux package.

Websites can have more than one .htaccess file, but usually there is one located at the root (top level, often called public_html) of the website. If you installed WordPress in a subdirectory, such as /blog, the .htaccess is probably there.

Creating a 301 redirect with an .htaccess file is possible but you should make a backup copy before redirecting. Because if you make a typo in the .htaccess on the website, you will get a 500 Server Internal Error message.

To start using .htaccess files to redirect pages on your website, open an FTP and log in to your website. When you edit files, you can use a UNIX text editor instead of Notepad.

Here is some code to add a 301 redirect via .htaccess:

a. Redirect from old page to new page


If you want to change the page URL from the old page to a new page, for example http://yourwebsite.com/blog.html to a new page http://yourwebsite.com/blog , you can use code like the one below

code :

Redirect 301 /blog.html https://.websitekamu.com/blog

b. Redirect from old domain to new domain


If you want to change the old domain to a new domain, for example, from your website.com to your website.com, you can use code like the one below:

code :

RewriteEngine on

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

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

RewriteRule ^(.*)$ https://yourwebsite.com/$1 [L,R=301,NC]

c. Redirect to Remove www


If you want to get rid of www in website URLs, you can use code like the one below

RewriteEngine on

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

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

If you want to add www, you can change the code the other way around.

d. Redirect domains from HTTP to HTTPS


If you want to change the domain from HTTP to HTTPS then use code like the following:

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Note: you must have an SSL certificate installed on your website for this redirect to work. If not, you will get a warning message "Not Secure"

e. Redirect from non www to www and from HTTP to HTTPS


If you want to change from non www to www and from HTTP to HTTPS use code like below :

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\. [NC]

RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP:X-Forwarded-Proto} !https

RewriteCond %{HTTPS} off

RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

3. Use the 301 Redirect Plugin


If you use WordPress, you can use a plugin for a more efficient and easy way. You need to download and install a plugin called Redirection.

With the Redirection plugin, you don't need to do any coding anymore. Just enter the old URL and the new URL then click the Add Redirect button. For example as in the following image

3 Easy Steps to Do a 301 Redirect on Your Website


3 Easy Steps to Do a 301 Redirect on Your Website

However, this plugin can only be used to redirect 301 to old pages to new website pages in one web domain.

Apart from using redirection, there are several other 301 redirect plugins that can be used on WordPress such as Simple 301 Redirects, Easy Redirect Manager, SEO Redirection, 301 Redirects, Easy HTTPS Redirection and others.


Conclusion


Redirect 301 is a redirect command used to notify search engines that a page has been moved permanently to another page. This redirect is used when you want to redesign a website, content has expired, to combine two websites, change permalinks, rename a post, change a new CMS to migrate to HTTPS.

The reasons for doing 301 redirects especially for marketers are to associate common web conventions with one URL, to change names for rebranding needs, traffic from other URLs belong to the same company, quick fixes and ad tracking.

There are 3 ways you can do a 301 redirect, namely by entering the 301 redirect instruction into the old URL header, using the .htaccess file settings and finally using the 301 redirect plugin. If you use the .htaccess file settings, you need to run Apache if web hosting is used. is a Linux package. Hopefully this article provides insight into 301 redirects and can be useful for you.
Tags:

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn more
Ok, Go it!