Article overview

Help article

Redirect your website using .htaccess

In this article we'll explain how to redirect a website on a Web Hosting package to a different URL.

If you don't have a Web Hosting package, you can also choose our Forwarding Service to easily redirect your domain name. It even allows you to forward all email to an email address of your choosing. Read the article 'Forwarding your domain name' for more information.

Read the article 'Forward email addresses on your Web Hosting' to learn how to forward emails using the email addresses on your Web Hosting package.


Create an .htaccess file

With an .htaccess file you can easily redirect (a part of) the website on your Web Hosting package. By adding a specific line to the .htaccess file, you'll be able to choose the Redirect method and the target URL to redirect to.

We recommend reading the article 'Using an .htaccess file' before continuing.

Take note: Adding or editing an .htaccess file can have an effect on the performance of your website. The smallest typo may cause errors when visiting your website.

 

This is why we recommend closely following the steps presented in this article.


Redirect your website with an .htaccess file

Below we'll show you the different ways of redirecting your website with .htaccess. Add the lines from the code block to your .htaccess file and upload it to the directory you want to apply the .htaccess file to.

You should check if an .htaccess file is already present in the directory you want to upload it to. If that's the case, make sure to edit that .htaccess file, add the lines from the code block to this file and upload it to the directory again.


If you're using WordPress and a .htaccess file is already present, be sure to add the lines from the code block at the top of the .htaccess file and upload it to the same directory.

301 (permanent) Redirect

A 301 Redirect allows you to permanently redirect your website and all subdirectories. A 301 Redirect is the most commonly used redirect method.

In the image below you can see how we redirect our website to transiptutorial.com.

example of a 301 redirect

  • The first line starts with a symbol, indicating what the line below does. The text after the symbol is not an active part of the .htaccess file.

  • The second line executes a simple action: Using a 301 redirect, send visitors from my website to the address https://transiptutorials.com.

A 301 Redirect causes search engines to index the URL you're redirecting to.

302 (temporary) Redirect

A 301 Redirect allows you to temporarily redirect your website and all subdirectories. This is especially useful if you want to temporarily show a landing page on another URL and switch back at a later moment.

In the image below you can see how we redirect our website to transiptutorial.com.

example of a 302 redirect

 

  • The first line starts with a symbol, indicating what the line below does. The text after the symbol is not an active part of the .htaccess file.
  • The second line executes a simple action: Using a 302 redirect, send visitors from my website to the address https://transiptutorials.com.

A 302 Redirect causes search engines to primarily index the original URL.

 


Upload your .htaccess file

Earlier in this article we showed you how to create an .htaccess file using the steps in the article 'Using an .htaccess file'. The article also tells you how to upload the .htaccess file to your Web Hosting package.

For your convenience we will show you how to create and upload an .htaccess file for redirecting your website here as well.

In the example below we are redirecting our website to transiptutorials.com using a 301 Redirect. We then upload this file using the 'File Manager' in the control panel. You can also use SFTP software such as Filezilla or Cyberduck for this purpose.



Step 1

First you will need to create a simple text file (we recommend using Notepad++). Add the line from one of the Redirect methods above and save the file as .htaccess (don't forget the dot and entering the URL you wish to redirect to).

example of a 301 redirect



Step 2

Log in to the control panel and navigate to your domainname via the 'Domain & Hosting' tab. Click 'Manage webhosting' next to 'Webhosting' to manage your website on the webhosting package.

click Manage webhosting

On the overview page of your shared hosting, click 'File Manager' in the top right.

click sftp filemanagement



Step 3

Because we want the .htaccess to apply to our main domain (transiptutorials.com), we open the 'www' directory.

In here, press the 'Upload' button and open the .htaccess file to upload it. That's it! Your website's visitors will now be redirect to the URL you entered in the .htaccess file.

Take note that .htaccess files apply to the directory you upload it in, as well as all it's subdirectories. However, it is important to remember that .htaccess files have priority over directories higher up.

 

For example, if you've created two .htaccess files with 301 Redirect that both contain a different URL. You upload one .htaccess file to the 'www' directory and the other .htaccess file to the 'blog' directory, which resides inside the 'www' directory.

 

The 301 Redirect in the 'www' directory will apply to the 'www' directory and all it's subdirectories, but does not apply to the 'blog' directory and it's subdirectories. For the latter directories, only the 301 Redirect inside the 'blog' directory applies.



In this article we explained how to redirect a website on your Web Hosting package, using an .htaccess file.

If you have any questions regarding this article, please contact our support team. You can reach them using the 'Contact us' button below or via the 'Contact' button inside your control panel.

If you wish to discuss this article with other users, feel free to leave a comment below.

Has this article been helpful?

Create an account or log in to leave a rating.

Comments

Create an account or log in to be able to leave a comment.