Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Create a 301 Redirect

This guide shows how to send visitors from an old web address to a new one for good.

Web Hosting2 min read13 steps1 screenshots

What is a 301 redirect?

A redirect sends a visitor from one web address to another. A 301 redirect says the move is permanent. It is like a post office forwarding your mail when you move house. Search engines learn the new address and keep most of your ranking.

When do you need it?

  • You moved to a new domain.
  • You renamed or deleted a page.
  • You want www and non-www to go to one address.
  • You switched from HTTP to HTTPS.

Method 1: Using the control panel

Many control panels have a redirect tool. Look for Redirects in the Domains section.

  1. Log in to your control panel. Your welcome email has the details.
  2. Open Redirects.
  3. Choose the type Permanent (301).
  4. Pick the domain, then type the old path.
  5. Type the full new address in the redirect box.
  6. Click Add.

Method 2: Using the .htaccess file

.htaccess is a settings file for the Apache web server. It sits in your site folder, often public_html. It works only on Apache servers.

First, make a backup copy. A mistake in this file can break your whole site.

  1. Open your file manager or an FTP program.
  2. Turn on the option to show hidden files, since the name starts with a dot.
  3. Open .htaccess. If it does not exist, create it.
  4. Add the line for the job you need, from the examples below.
  5. Save the file and test in a browser.

Redirect one page:

Redirect 301 /old-page.html https://www.example.com/new-page.html

This sends the old page to the new one.

Redirect a whole domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$ [NC]
RewriteRule ^(.*)$ https://newdomain.com/$1 [R=301,L]

These lines send every page of the old domain to the same page on the new domain. Replace the example names with yours.

Test it

  1. Open the old address in a private browser window.
  2. Check that you land on the new address.
Tip: Browsers remember 301s. If you test and then undo, clear your cache.

Need help? Open a support ticket.

Quick recap

  • A 301 redirect is a permanent forward.
    Screenshot: A 301 redirect is a permanent forward.
  • Use the control panel tool or .htaccess.
  • Back up .htaccess before editing.
  • Test in a private window.