cPanel is a very popular website hosting control panel. Sometimes we need to redirect our website to another domain or to another URL.
cPanel provides an in-build feature to handle such kinds of requirements.
Today we understand how to redirect requests to another domain or URL in cPanel.
Step 1. Open cPanel
Step 2. Go to “DOMAINS” then click on “Redirects”
Step 3. It will open the “Redirects” settings page.
You can see the following settings on the “Redirects Page”
Type : Permanent (301)/Temporary (302) – Use redirect type based on your requirement.
https?://(www.)? : ** All Public Domains ** – You can select ** All Public Domains ** or any specific domain from where you redirect.
Redirects to : Use target domain or URL for the redirect requests.
for example, if you want to redirect all requests from test.abc.com to https://www.xyz.com/ then select “test.abc.com” in https?://(www.)? dropdown then put “https://www.xyz.com” into the ” Redirects to” field.
www. redirection: Only redirect with www. /Redirect with or without www. /Do Not Redirect www. – Select redirection www or all requests. and click “Add” button.
Step 4. List of Redirects – Go to the bottom of the page. You can see a list of current redirects.
Conclusion –
cPanel provides many inbuilt features to handle websites. Redirects requests can be handled via .htaccess file , you can use the following code if you want to implement redirect via .htaccess file.
RewriteCond %{HTTP_HOST} ^test\.abc\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.abc\.com$
RewriteRule ^/?$ "https\:\/\/www\.xyz\.com\/" [R=301,L]