How to manage domain redirections in cPanel?
Introduction
The process of creating a Visitors from a web address to another is considered to be Forwarding is the term used. Technically speaking, redirection takes place at the level of the web server, as it is responsible for receiving and responding to web requests for a website. To set up a redirect, the web server must therefore be instructed to redirect the visitor to a different domain or URL each time a particular domain or URL is accessed. This is usually done by editing a special file with instructions for the web server called ".htaccess". This file is located in the document root of each domain that is connected to your web hosting account. Editing it requires special knowledge of the syntax of web server rules. Since not everyone is familiar with this syntax, cPanel provides a function that allows you to easily set up and manage redirects without having to write a single line of code.
Video tutorial: How to set up domain forwarding?
The Forwarding function in cPanel
Before you can continue with this tutorial, you must log in to the Register cPanel. To do this, please follow our tutorial "Access to cPanel". If you are already logged in or know how to access cPanel, please continue with these instructions.
As soon as you are logged into cPanel, please search for the "Domains" function group. In this group you should find the "Redirects" function. As soon as you see it, please click on it.
cPanel directs you to a new page "Forwarding" where you can manage all aspects of this function.
To add a redirect in cPanel
Let's start by adding a new redirect. The first section you see on the "Redirects" page is called "Add redirect" and is used to configure a single redirect. Of course, you can use this section multiple times to add as many redirects as you like, but please note that only one redirect per domain or URL will work.
The following configuration fields are available in this section:
Type - Select the type of forwarding.
Permanent (301) - This redirect tells the visitor's browser that it is a permanent redirect, which means that the browser must store it in its records.
Temporary (302) - This redirection is used when you want to redirect the visitor to a new domain or URL only temporarily. Please note that the visitor's browser will NOT remember this redirect.
https?://(www.)? - Select the name of the domain for which you want to set up this redirection. Please note that by default the value "All public domains" is selected. If you keep this setting, all domains that you have added to your account will be redirected, which is very unlikely.
/ – This field is used if you want to redirect a request to a file or folder. For example, if you want to redirect domain.com/blog/ to blog.domain.com, enter "blog/" in this field as this is the URI that should be redirected. The same applies if you want to redirect a request to a file. For example, if you want to redirect a request from domain.com/blog.html to blog.domain.com, enter "blog.html" in this field.
Redirection to - Enter the full URL here to which the visitor should be redirected. For example, if you want to redirect a visitor from domain.com to neuedomain.com, enter "https://neuedomain.com" or even the URI "https://neuedomain.com/blog/" in this field if it exists. Please note that you must enter the full URL including the protocol and the URI.
www. - redirection - Here you can specify whether the visitor must enter www before the forwarded domain name or not.
Wildcard redirection - When this option is selected, the web server is instructed to redirect all requests to a file or URI associated with the configured domain to the new address, but with the same file or URI. For example, if you want to redirect domain.com/blog.html to new-domain.com/blog.html, enable this option and whatever file is requested from domain.com will be redirected to the same file, but for new-domain.com.
To add the configured redirection, please click on the "Add“.
cPanel then creates the configured forwarding and displays a status message whether the forwarding was created or not.
Manage current redirects in cPanel
Now that you know how to add a new redirect, let's take a look at what you can do with the existing redirects. The second section of the "Redirects" page is called "Current redirects". In this section, you will find a table that contains all configured redirects as rows of data. Several columns of information are displayed for each redirect. Let's take a look at them.
Domain - The actual domain name that was redirected.
Directory - If redirection is configured for a specific directory of the redirected domain.
Regular expression - If you have configured regular expression redirects, cPanel will redirect all requests that match that regular expression.
Redirect URL - This is the URL to which visitors will be redirected when they access the redirected domain or URL.
HTTP Status Code - The HTTP status code of the redirect.
Type - The type of redirection considering the status code. As we have already explained, cPanel supports only permanent or temporary redirections.
www available - If you have configured the redirection to redirect visitors who have inserted the www. prefix before the redirected domain name.
Wildcard - Here you can see information about whether wildcard forwarding was used or not.
Actions - The only available action you can take on a redirect is to actually remove it. Please note that redirections cannot be edited. To edit a redirect, you must remove it and then add it again.
As you can see, managing redirects for your domains is quite a simple task, but understanding how redirects actually work is often difficult for non-technical users. So, if you are not sure how to configure redirection for your domains, don't hesitate to contact our technical support so that we can help you with this project.
We have other interesting topics for you:
How do I manage the File Manager in cPanel
How do I create a Google Analytics account
More Interesting articles you can also find in our blog