How to redirect a domain

There are several methods for redirecting a domain or website. We will go over some of the most common methods here.

 

Domain Alias

 

If you want all of your traffic to a domain to transfer to a different domain, then an alias is your best bet. An alias domain will send all web traffic, whether web site or emails, to the target domain.

 

To add an alias domain, you will first need to log into your cPanel. You can find a guide on logging into your cPanel here. Once you are logged in, scroll down to the Domains section. Now click on Aliases.

 

You can now create an alias by entering the domain in the Create a New Alias field and clicking Add Domain. This will create the zone file for your Alias domain. You will now need to set the domain to use our nameservers. There is a guide on how to update nameservers here.

 

Once you are back at the Aliases page, you should see your alias domain in the list of aliases at the bottom of the screen. By default, your alias domains will redirect to your primary domain. You can edit your alias target here by clicking on Manage Redirection to the right of the domain.

 

If you wish to remove the alias, click on the Remove button.

 

Redirects App

 

Another method of redirecting a website is using the Redirects app in cPanel (see above for information on logging into your cPanel). You will find the Redirects app in the Domains section as well.

 

The advantage of using this method is that you redirect only parts of your domain to another server. This is helpful if you want to redirect the website, but not the emails or other services. You can also only redirect parts of you website using this tool.

 

When the page loads, you will see the top part is where you can Add Redirect.

  • Type
    • Here you can choose between Permanent (301) or Temporary (302)
    • Permanent will notify the users browser to update bookmarks that are linked to the page
  • Https?://(www.)?
    • While this is a crazy title for this field, it is only asking for what domain you are looking to redirect
    • Select it from the drop down menu.
  • /
    • Here you can select what subfolder of the domain to redirect.
    • Leave this field blank to redirect the whole site
  • Redirects to
    • This is the target domain
  • www. Redirection:
    • Choose whether the both the blank and www domain is redirected
    • example.com and www.example.com
  • Wild Card Redirect
    • Checking the Wild Card Redirect Box will redirect all files within a directory to the same filename in the redirected directory.
    • You cannot use a Wild Card Redirect to redirect your main domain to a different directory on your site.

 

Once you have all of the fields filled in, click Add to create the redirect. You will see all of your current redirects at the bottom of the page. You can remove them from here. Unfortunately they cannot be modified, you will need to delete the current redirect and add it back.

 

.htaccess redirect

 

A more advanced method of redirecting a site is by adding some code to your .htaccess file in your document root folder.

 

An .htaccess file is a configuration file that is used to overwrite certain server configurations, and can be a very useful tool. Find out more about .htaccess here.

 

You can create or edit your .htaccess file from your cPanel File Manager. Once logged into your cPanel, go to the Files section and click on the File Manager.

 

You should find the .htaccess file in your document root folder, typically the public_html folder. If you do not see it, it could be that is hidden or not created yet.

 

To show hidden files, click on the Settings button in the upper-right hand side. Now ensure that the Show Hidden Files (dotfiles) option is checked and click Save.

 

If you still do not see the .htaccess file, you will need to create one. Click on the + File button in the upper left-hand side. When the window pops up, enter .htaccess as the New File Name and click Create New File.

 

Now you can edit your .htaccess file. If there was a one created already, then there is most likely some code in there already. You can disable any code in there by preceding it with "#". This will allow you to reenable it if needed. If you are redirecting the site, you can disable all of the other lines.

 

Now you can add the redirect code. It should look something like this:

 

# Redirect to HTTPS

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]

RewriteCond %{HTTP_HOST} ^www.olddomain.com$

RewriteRule ^(.*)$ https://www.newdomain.com/$1 [R,L]

 

Make sure you replace olddomain.com with the site you are looking to redirect and www.newdomain.com with your target.

 

Save the edited .htaccess file. The next time you visit the site, you should be redirected to the new site. You may need to clear your cache and cookies first.

 

Did this answer your question? If not, please let us know what issues you're having by submitting a ticket.

 

 

 

 

 

 

  • redirect, website
  • 30 Users Found This Useful
Was this answer helpful?

Related Articles

How to Upgrade and Downgrade your package

  Difficulty:   1. First login to your Client Area....

How to setup a Subdomain

1. login to your cPanel by going to: http://www.yourdomainname.com/cpanel (yourdomainname.com...

Unlock your domain name for transfer

As a security measure, domains can be locked against being transferred. This help protects you...

Change the contact details listed with your domain

It is vital that your domain contact information is kept up to date at all times. Not only...

Changing Nameservers for Your Domain Name

Your domain Nameservers are an important part of your web hosting service. It directs...