Skip to main content
301 redirect htaccess feature image

Setting up permanent 301 redirect htaccess in WordPress.

301 redirect htaccess:- If you belong to the web technology than I am sure you already have heard about the term “301 redirect htaccess”. Web developers use this term frequently.

If not, don’t worry I will try to explain it in simple words. And I am sure at the end of this post you would understand this term’s meaning.

Before dive deeply I just want to define the term in a single sentence.

Everyone knows the meaning of redirect. If not, I would like to give a simple sentence about the meaning of redirect.

Diverting something to another destination instead of its real destination is called redirection.

The term “301 redirect htaccess” is also known as a permanent redirect.

Now in your mind, the question arises.

 

What is htaccess file?

Let me explain about the term htaccess.

It is a configuration file. Web servers which are running Apache webserver software use this configuration file.

A htaccess file is a control file that allows server configuration changing on a per-directory basis.

The htaccess file controls the directory and its subfolders within that directory that holding htaccess file.

The htaccess file starts with a dot (.) to make it hidden in a directory.

The web root directory of your site contains the file htaccess and the file contains web server written directives.

These directives can alter the web server configurations files. Create a htaccess file If there is no one.

No one wants to lose their ranking position in any of the search engines.

But there are some situations that happen unknowingly.

And we start to lose our post ranking in search result.

Now a query arises in our mind.

Why 301 redirect htaccess is need?

There are some situations where you might need 301 redirect htaccess implements. I am explaining a few of the most common.

  1. You are changing the entire domain.
  2. Your post or page URL contains a typing mistake and you want to modify it.
  3. You want to reorganize pages or post by changing or removing a directory.
  4. Moving some pages to a new site structure.
  5. Merging two sites into single.

The term htaccess redirect means diverting URL to another destination with the help of htaccess file.

So that all the traffic coming to the old resource could reach the new location.

The main intention behind the URL redirection is retaining the SEO, the earned page rank of that URL earlier.

A 301 redirect htaccess is used to command the search engines that the following URL has been replaced permanently by a new URL. You have to index the new URL and drop the old one from your indexed list.

The 301 redirect powers you to send traffic and search engines to the new URL that’s different from what was originally requested.

How to implement 301 redirect htaccess?

Before implementing 301 redirect htaccess make sure you have access to your server and Apache configuration file.

If not, call to your hosting company and get access to the server and Apache configuration files.

Your next step is to find out the htaccess file, once you are sure you have access to that file.

In most cases, root web directory in your site contains this file.

You can access the htaccess file using two methods.

Using FTP client accessing htaccess file.

To start accessing htaccess for redirecting your site pages and post you need to open up your FTP client and log in to your site.

Now it’s time for implementing 301 redirect htaccess. To do that you will have to open up your FTP client and log in to your site.

Keep a backup copy of that configuration file before changing htaccess file. The site could be restored to its previous status if it leads to an error.

For 301 redirect htaccess you will have to add the following code to tell the server what to do.

To redirect a page.

RedirectPermanent http://www.domain.com/old-slung.html http://www.domain.com/new-slung.html

To redirect the entire domain.

RedirectPermanent / http://www.new-domain.com/

Using hosting account accessing htaccess file.

In this method, you will have to log into your hosting account.

Go to your hosting account Cpanel. A window opens with app icons. Click on “File Manager” icon.

file manager

A new window opens with a list of files and folders. Click on the gear icon at top right of the window.

Select an option the way you want to open your hosted files in future as the default mode. Make sure you have checked the option “Show hidden files”.

show hidden files

Now find out the .htaccess file from the list and select it. Click on the edit button at the top. A new window opens to chose an option “Disable encoding check”.

character encoding

Click on the edit button again without changing any option. You can disable encoding check if you want.

select htaccess

The htaccess file opens in edit mode now you can add your code as per your requirement option. After that click on the save button at the right top of the window.

select htaccess

You have successfully added the code to the file. Your 301 redirect htaccess is complete.

Have any questions implementing 301 redirect htaccess? Let me know. I will be happy to help you out.

The idea behind this post is taken from “How to properly implement a 301 redirect” that posted by Bruce Clay.

Founder , WebtechThoughts

Barun Chandra is technology enthusiast and a blogger. He is fond of technology in depth and writes posts in simple words to make understand easy.

Get Free Email Updates!

Signup now and receive an email once I publish new content.

I agree to have my personal information transfered to MailChimp ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Leave a Reply

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