What is a Domain Redirect and how it can be done in cPanel
Create a domain redirect in cPanel by automatically changing the htaccess file.
A website redirect to another website is an action that is used rarely. In most cases such need appears when a domain name of an application changes or individual urls of a site change and appear in new urls. By using redirects you can avoid the creation of broken links because the browsers of your visitors are informed about the new address of the page they are trying to visit.
The redirect implementation can be done through the code of the used application (eg. php header redirects) or through the .htaccess file of your website. cPanel has the appropriate user interface to make the domain redirect easily without the need of code knowledge. Domain redirects through cPanel are achieved by modifying your website's .htaccess file and not the code of your application.
- Login to cPanel.
- Then select the Redirects option under the Domains category.
- You will see the Add Redirect page. There you have to select if you want to create a Permanent (301) or a Temporary (302) redirect from the drop-down Type menu.
- Then click the next drop-down menu and select the domain that you want to redirect. In the slash "/" field you can type the folder names if necessary.
- Next type the address where you want to redirect to in the Redirects to category.
- If you want you can select "Only redirect with www." "Redirect with or without www." or "Do Not Redirect www."
- If you select the Wild Card Redirect checkbox the file/folder name will be added after the url address while redirecting. For example, the example.com/test.php redirects to example2.com/test.php.
- Finally click the Add button.
For supervisory purposes you can see the modifications made to the .htaccess file through the File Manager.