How to Redirect using Htaccess – Rules for 301, 302, HTTPS

How to configure redirection using .htaccess file. Htaccess is file which is used to make changes to your web server configuration without editing the server configuration file. This .htaccess file will be placed in your website root directory.

In this guide you are going to learn to how to configure some list of redirections which is mostly needed for your SEO and ranking in search engines.

  1. Create an empty text file using a text editor such as notepad, and save it as htaccess.txt
    • The reason you should save the file as htaccess.txt is because many operating systems and FTP applications are unable to read or view .htaccess files by default. Once uploaded to the server you can rename the file to .htaccess.
  2. Edit the contents of the htaccess.txt file. Below are some example redirects you can use. They are labeled in accordance to what actions they will perform.
    • 302 (Temporary) Redirect:

      Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:

      # This allows you to redirect your entire website to any other domain
      Redirect 302 / http://example.com/
    • 301 (Permanent) Redirect:

      Use a 301 redirect .htaccess to point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "example.com" domain.

      When adding the following to your website's .htaccess file, be sure to replace example.com with your own domain name.

      # This allows you to redirect your entire website to any other domain
      Redirect 301 / http://example.com/
      
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

About Hosting panel

Important Links Host panel link: https://host.teradig.com/  

Expiration and deletion of domain registrations

Domain Name Expiration reminder notice Approximately one month before your domain registration...

How to change password for your mailbox

Login on host.teradig.com using your hosting panel credentials Click on Email Click on Email...

Test Credit Card Account Numbers

While testing, use only the credit card numbers listed here. Other numbers produce an error....

Getting Started with WordPress and Teradig Hosting: A Step-by-Step

Ordering a Domain and Hosting Plan: a. Open your web browser and go to...