Proudly Hosting over 100,000 Fast Websites since 2010

How can we help you?

Type your topic or keywords and hit enter to search our knowledgebase.

How to Redirect a Subdomain to an External URL

1. Log in to your cPanel account.

2. In the Domains section, click on Subdomains.

3. Under the Modify a Subdomain list, you can see a list of subdomains.

4. Click on Manage Redirection, which corresponds to the subdomain you wish to manage.

5. Under the Redirection field, enter your website address.

6. Click on Save.

Below you’ll find some explanation for those who seek detailed answers for better understanding. 

Redirecting a subdomain to an external URL typically involves modifying the DNS settings for the subdomain to point to a server that will handle the redirection. Here’s a detailed explanation:

  1. Access DNS Settings: Log in to your domain registrar or hosting provider’s control panel to access the DNS settings for your domain.
  2. Locate Subdomain: Identify the subdomain that you want to redirect. This could be something like “subdomain.yourdomain.com”.
  3. Create DNS Record: Look for the option to create a new DNS record. You’ll need to create a CNAME (Canonical Name) record for the subdomain.
  4. Set CNAME Record: Set the CNAME record’s value to point to a domain name that you control and where you will set up the redirection. For example, you could create a subdomain like “redirect.yourdomain.com” and point the CNAME record for “subdomain.yourdomain.com” to “redirect.yourdomain.com”.
  5. Set up Redirection Server: On the server pointed to by the CNAME record (e.g., “redirect.yourdomain.com”), set up a web server (e.g., Apache or Nginx) if you haven’t already done so.
  6. Configure Redirection: Once the web server is set up, configure it to handle requests for the subdomain and redirect them to the external URL. This can typically be done using server configuration files like .htaccess (for Apache) or server block configuration (for Nginx).
  7. Testing: Test the redirection by entering the subdomain in a web browser and verifying that it redirects to the external URL as expected.

Here’s a more detailed breakdown of configuring redirection using Apache’s .htaccess file:

IMAGE Redirect 

In this example:

  • RewriteEngine On: Enables the Apache rewrite engine.
  • RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com$ [NC]: Matches requests for the subdomain “subdomain.yourdomain.com” ignoring case sensitivity.
  • RewriteRule ^(.*)$ http://www.externalurl.com/$1 [R=301,L]: Redirects all requests for the subdomain to “http://www.externalurl.com/“, preserving the requested URI.

Remember to replace “subdomain.yourdomain.com” with your actual subdomain and “www.externalurl.com” with the external URL you want to redirect to. 

Additionally, if you’re using a different web server (e.g., Nginx), the configuration steps will vary slightly.

Updated on April 28, 2024