fb-pixel
Logo Supporthost
Log in

Domain redirect

October 16, 2021 / Published in:  from Ivan Messina
No comments

A domain redirect is a redirect from one address to another. For example, when a user visits the SupportHost.net addresses, he is redirected to the SupportHost.com website

With SupportHost, you can set up a domain redirect in a few simple steps and at no additional cost.

This way, you can buy different domain extensions and have them all redirect to the main domain by simply setting a domain redirect.

This can be useful for brand protection purposes and to prevent others from registering the same domain with different extensions.

In these cases, usually, it is convenient to use a 301 redirect to let everyone know that this is a permanent redirect.

There are two different ways to set up a domain direct, let’s see them.

Set up the domain redirect from the client area

Log in to the SupportHost client area.

Click on “Domains” or from the menu on Domains -> My domains.

Client Area My Domains

You will see the list of domains you have with SupportHost.

By clicking on the domain name, you visit your website, if you click on the row related to the domain, you can manage it.

Manage Domains

In the sidebar on the left, you can see an item that enables you to set the domain redirect: “Url forwarding”.

If this section is not present, click on “DNS management“.

Dns Management

If you don’t see this menu item open a support ticket. The DNS management may not be enabled for your domain. In this case, we can enable it for free.

On this page, you will see a red alert. If your domain is not connected to any hosting account, you can continue without problems.

If, on the other hand, your domain is connected to one of our hosting accounts, and you are not sure about the changes you are about to make, contact our support to avoid a website downtime.

Dns Management Alert

By clicking on “I’m aware of the risk” you are sent to the edit page. You will need to enter the redirect values ​​you want to set up like this:

Dns Management Domain Redirect

In the address field, you will enter the url to which you want to set the redirect.

After you insert the record with the wildcard (*), the third record with the empty Hostname field is automatically created.

This method has a limit. If your user types HTTPS: // in the address bar before the domain name, the redirect will not work.

Let’s see a solution to this problem.

Set up a domain with redirects using Cloudflare

To solve the above problem, we can use Cloudflare. The free plane is enough for this.

Let’s add our domain on Cloudflare by following the wizard on their website. Once we have added the domain, we change the domain nameservers to make it point correctly to Cloudflare.

As soon as the domain points correctly to Cloudflare, click on rules at the top to create a redirect rule.

Cloudflare Rules

Then click on “Create page rule” to create the rule.

Create Rule Cloudflare

In the next page, we fill in the fields like this:

Add Rule Cloudflare

To apply the rule, just click on “Save and Deploy“. If the domain points correctly to Cloudflare, the redirect will work instantly.

To be safe, it is recommended to set another rule by including “www.” before the domain name. This way, we are sure that when the domain is visited in all its versions, the 301 redirects will work as expected.

Once we have set all the rules, we should see them like this:

Cloudflare Redirection Rules

We can check if this works correctly by using a service like Redirect checker.

If we no longer need the redirect in the future, we can temporarily disable the rule by clicking on the green selector.

If you want to delete it, just click on the “X” icon on the right.

We can edit the rule by clicking on the edit icon, and we will return to a screen similar to the one we saw before while creating the rule.

Set up the redirect via cPanel

If you have purchased a hosting plan, you can also set up a domain with redirects using cPanel. To do this, just log in the client area and then click on the “Services” tab.

Client Area Services

Now select the hosting plan you want to change.

Select Services

On the page that opens, click on the item “Login to cPanel” in the “Actions” menu.

Actions Login To Cpanel

Now, find and select the tool “Redirects” in the DOMAINS section.

Domains Redirects Cpanel

From this page, it will be possible to enter all the data to be able to create a redirect. You have to fill in all the fields like this.

Add Redirect Cpanel

Once the changes have been made, we just have to save the changes by clicking on the “Add” button.

Add Button

If we have entered all the data correctly, an informational message will come out.

Success Redirect

We can see the changes made by typing our old URL in the address bar of the browser, or we can use a redirect checker like before.

Edit the .htaccess file

There is another way to create a domain redirect, and that is by editing the “.htaccess” file.

The .htaccess file is a text file and is present on every website. To modify it, you need to access cPanel and clieck on the “File Manager” icon.

File Manager Cpanel

The .htaccess file is usually located in the “public_html” folder, if you can’t see it, press the “Settings” button in the top bar.

File Manager Settings

In the preferences, check the box “Show hidden files (dotfiles)” and click on “Save”.

Show Hidden Files

Now, returning to the “public_html” folder you should be able to see the file. Select it and click on “Edit“.

Edit Htaccess

As soon as you try to edit this file, a warning message will appear, ignore it and press the “Edit” button.

Edit Htaccess File

Here you can enter the new redirect rules. For example, if you want to redirect all urls form the old domain to a new one, just edit and add the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.oldwebsite\.com$
RewriteRule (.*) http://www.newwebsite.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^oldwebsite\.eu$
RewriteRule (.*) http://www.newwebsite.com/$1 [R=301,L]

Once you have added all the necessary rules, press the “Save changes” button to complete the procedure and make the changes effective.

Redirect Rules

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

crossmenu