How to redirect a domain: 2 easy methods
There are some methods available to redirect a domain name. In this article, we will explain how to do that. Note that here we will show how to redirect the whole domain (any path and any URL inside it). If you need to redirect only a specific URL (not the whole domain), we recommend this article. Although a URL redirect may look similar to a domain redirect, the effect is pretty different.
In these examples, there is no need to change the DNS Servers of your domain name. We can redirect the whole domain by cPanel or by editing the .htaccess file. As you configure such redirection, you can easily rollback (undo) the changes. The configuration takes effect immediately after applied. Make sure to have the correct destination URL for the redirection. Otherwise, a 404 error code message can happen.
Method 1: How to redirect a domain using cPanel
Firstly, access your cPanel control panel. Scroll a bit, until you find the option redirects, which is located under the Domains section.
Then, you will reach the domain redirect configuration page.
Now, select the source domain. For instance, our source domain is mysamplewebsite.com.
You will place the target destination domain under the Redirects to section.
And at the end of the page, make sure to select Wild Card Redirection option. This option will ensure that any page of your source domain will be redirected to the target domain.
Then click Add.
You are done and the domain is now being redirected.
Method 2: Redirect your domain using .htaccess
Firstly, you need to have FTP access to edit files in your server. You need to edit a file and name it .htaccess . Make sure not to forget the “.” at the beginning of the file name.
Simply add this like to the .htaccess file:
Redirect / http://www.mynewwebsite.com/
Then, just upload it to your server. If your server uses cPanel, you have to place this file inside the /public_html folder.