Wordpress

What is a 301 Redirect? How Should You Use One?

How to do .htaccess 301 Redirect codes and wordpress 301 redirect? What are 301 persistent redirect methods? What does a 301 redirect do, is it harmful? How should you evaluate if you have hit and DA-PA valuable domains and you do not use them?

You can redirect the URLs of the content on your site to another URL of your choice by making the 301 redirection you need to do while moving the URLs of your site’s files in your old domain to the URLs of another site. Well; what is this 301 redirect? In the article I have prepared for you, I will explain the 301 redirect in full detail.

What is a 301 Redirect?

Before I convey my information about 301 redirects to you, we need to know more or less what the redirects are. In short, it means that users on your current web page redirect to another web page when they click on any content. That’s why we use 301 redirects when redirecting from one site to another.

There are 5 different methods of redirects. However, only 2 of these 5 different methods are used today. I will explain these two options to you in detail. The first redirect is examined under two headings as “temporary redirects (302)” and the second “permanent redirects (301)”. I will tell you about 301 redirects, since the most important for us are permanent redirects.

We can define a 301 redirect as a permanent redirect from one page to another. For this reason, we can definitely say that a permanent link is sent from a page using a 301 redirect to the other page.

What Does a 301 Redirect Do?

As I explained above, redirection allows search engines to make a permanent transition from the URL of one page to the URL of another page.

After we tell search engines which page is our home page, we can determine the URL we want to redirect. We can pass the URL, we specified to the URL we want to redirect. In this way, search engines will understand that URL1 is now URL2 and will direct the visitors of URL1 to URL2.

Full Domain Redirects

One of the most important things we need to pay attention to when making our redirect is to redirect websites in the same industry to each other.  For example, when we get the URLs of any car site and redirect it to a phone site, we cannot get very positive results. That’s why we only need to redirect the same industry or sectors linked to each other to websites.

Using 301s to Unify Websites

Let’s say; you have 3 telephone companies called VODAFONE, TURKCELL and TÜRK TELEKOM and there are separate websites for these 3 companies and you want to turn them into a large website at a single address. Using 301 redirects, you can professionally manage 3 small sites under one site. However, the guidance for this should be done correctly and professionally. If the redirect is not planned and implemented properly, you can lose the SEO value of 3 small websites.

It may interest you:  Removing the WordPress dashicons.min.css code

URL Redirects to Remove

One of the most beautiful features of 301 redirects is that if you have stopped selling any product on your e-commerce site and this product has good backlinks and has a good position in the SERP, you can easily benefit from the SERP location and backlinks by redirecting the URL of this page to the page of another product.

How to Make 301 Redirect?

Yes, since we have informed you in detail about Wordpress 301 redirects, we can proceed to explain how these redirects are made.

Almost all of the steps I will show you require code information. Therefore, if you have code knowledge, I recommend you to follow these steps and I recommend that you should take a backup of your site even if you have code information before you start doing these steps.

Using the Redirection WordPress Add-on

First of all, before showing the method with codes, you can do the redirect process using an add-on. The wordpress add-on that I recommend for the redirection process is the Redirection add-on. This add-on I recommend is among the most popular add-on on the official website of wordpress. With this add-on, you can see both 301 redirects and reports of 404 pages not found errors on your site.

  • You can easily download Redirection from your admin panel or from the wordpress official site.
  • After activating the add-on you downloaded, select the Redirection option from the Tools tab.
  • Then write your old URL in the section that says Source URL and write the URL you want to redirect to the Target URL section and click ADD REDIRECT.

With these operations, you can easily redirect wordpress 301.

How to Make a WordPress 301 Redirect with an .htaccess File?

You can redirect any text or page on your site as using like add-ons. But what are the steps you should take when you need to redirect a complete site to a new domain name?

If you have a little code knowledge, you can make 301 redirects by making changes in the .httaccess file.

You need to access your site files using any FTP or panel.

After you are granted access, find the .httaccess file in your files. After logging in, you should find an .htaccess file in the directory where the WordPress installation is.

If you haven’t made any changes in the .httacces file, the default of the .httaccess file when uploading your site is as follows.

#BEGIN Wordpress

RewriteEngine On
RewriteBase/
RewriteRule^index\.php$-[L]
RewriteCond%{REQUEST_FILENAME} !-f
RewriteCond%{REQUEST_FILENAME} !-f
RewriteRule ./index.php [L]

# END Wordpress

In addition to these codes, the codes of the add-ons or themes you have installed can be found in this file.

301 Routing Codes

When you decide to completely change your permanent links or your domain name, we need to write redirect codes to the .httaccess file.

I recommend that you back up your .httaccess file before making any changes to it.

Below are a few situations where you will need to add a 301 redirect to your .httaccess file.

-While redirecting any link to another link,

-When you change the URLs of the articles and pages on your site.

It may interest you:  5 Best WordPress Language Translation Plugins in 2021

Sample; / old-link / new-link, that is, while the link of any of your pages is “old-link”, when you change that link and make a “new-link”, the lines of code you need to add to your .httaccess file are as follows.

# BEGIN
301
Redirects
Redirect 301 /old-page https://yoursite.com/new-link
# END 301 Redirects

Redirect old domain to new domain

You can make a 301 redirect to change your domain name along with the content on your website. To make redirects, you need to add codes to your .httaccess file.

# BEGIN WordPress

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC,OR]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301,NC]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Redirect domain name to www version

301 redirects should be used if you want to make your site serving with http://example.com domain like http://www.example.com. You need to make these changes in your .httaccess file as we did in the other steps.

# BEGIN WordPress

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Redirecting the domain name to the www version

If you want to make your site serving http://www.example.com like http://example.com, you can easily do this by using redirect. You can use your .httaccess file in this process.

# BEGIN WordPress

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Redirecting all extension links to another extension link

You can direct your extension links on your website by adding codes to your .httaccess file to redirect links with other extensions. For example; You can use 301 redirects to redirect .php links to .html extensions.

# BEGIN WordPress

RewriteEngine On
RewriteCond %{REQUEST_URI} .php$
RewriteRule ^(.*).php$ /$1.html [R=301,L]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

You can comment your questions and ideas about 301 Redirection, and contact me for support.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button