How to redirect a subdomain

Looking for a way to redirect your subdomain to another URL, or another domain, but you don’t know how to go about it? 

We’ve got you covered, so you won’t have to do any of the research yourself! In this guide, we’ll dive into all the ways to redirect a subdomain. We’ll explain different methods, and compare each of them in a clear overview.

In this article you'll find: 

  1. What is a subdomain redirect? 
  2. Why would you redirect a subdomain? 
  3. Do you need to redirect www. URLs to non-www. URLs? 
  4. Ways to redirect a subdomain
  5. How to redirect a subdomain using redirect.pizza

What is a subdomain redirect?

A subdomain is a segregated domain linked to your main domain. It is a way to separate content from your main website to organize it. For instance, if you host a blog, you can use a subdomain for all your blog articles. Or if you host a webshop, you can use a subdomain for that.

A subdomain redirect is used to redirect traffic from your subdomain to another domain, or another URL. Traffic intended for the subdomain can be automatically redirected to any preferred place. For example:

  • Redirecting one subdomain to another: blog.example.com to articles.example.com
  • Redirecting a subdomain to a directory: blog.example.com to www.example.com/blog
  • Redirecting a directory to a subdomain: www.example.com/blog to blog.example.com

It’s also possible to redirect your www. subdomain to your apex domain, also called your root domain or naked domain. This can also work the other way around. For example:

  • https://www.example.com to https://example.com
  • https://example.com to https://www.example.com

Why would you redirect a subdomain?

There are a few reasons why you'd want to redirect a subdomain to your primary domain. Firstly, to consolidate all the content on the primary domain. Secondly, to minimize maintenance of the website. Lastly, there are a number of SEO related benefits to redirecting a subdomain to the primary domain explained below. 

Redirecting a subdomain, such as "blog.example.com" to the primary domain "www.example.com/blog" means that when users or search engine crawlers go to the blog subdomain, they are automatically taken to the blog directory on the main website. This is also the case for any SEO value from backlinks pointing to URLs on the subdomain. In other words, the backlink value is transferred to the destination URL on the primary domain, if a permanent redirect is used.  

In terms of SEO, a subdomain is often seen as a separate entity for search engine crawlers. This means that backlinks pointing to the subdomain (e.g. blog.example.com) will not increase the domain strength of the the primary domain (e.g. www.example.com). Hence many website owners decide to redirect subdomains to the primary domain. 

Do you need to redirect www. URLs to non-www. URLs? 

Most websites are accessible via both the "www." and "non-www." URLs. For example: 

  • https://www.example.com/article
  • https://example.com/article

When users land on one of these URLs, they both display the same page. This means that your entire website is essentially duplicated. Redirecting the "www." subomain to the apex domain, or the other way around, is a general best practice for website owners to ensure that users and search engines all visit one version of the website. This will also eliminate any SEO-related issues arising from duplicate content penalties. 

Ways to redirect your subdomain

Redirecting a subdomain might not seem like an easy process, since it requires making changes in your DNS settings while making sure you set up the proper redirects. But that’s why we’re here to help! Let’s take a look at the options for setting up a subdomain redirect. 

For redirecting a subdomain, different hosting environments offer various methods, each with its own set of pros and cons.

Some DNS providers allow you to set up a subdomain redirect via them. For example:

Namecheap 

With Namecheap, you can easily redirect subdomains by using the ‘Advanced DNS’ tab. Here, you can add URL Redirect Records or create subdomains that can be forwarded to different locations, such as URLs or IP addresses. Learn more about how to create a redirect in Namecheap

AWS Route 53 

With AWS Route 53, you can redirect a subdomain to another website or URL by setting up special DNS records, like A or CNAME records. The records serve as instructions that ensure the traffic is correctly directed to the intended destination. Learn more about it here

Cloudflare 

Like AWS Route 53, Cloudflare allows subdomain redirection by creating DNS records, such as A or CNAME records. Check out their how-to guide to learn more. 

GoDaddy 

GoDaddy supports subdomain redirection through its DNS management interface. You can use the interface to create forwarding rules for your subdomains.

 

What to consider when setting up redirects via your DNS provider:

  1. Complexity: with some DNS providers, setting up subdomain redirects can be tricky for users without technical DNS knowledge or experience.
  2. DNS Propagation: Redirection changes in DNS records may take up to 48 hours to apply globally, causing inconsistent user experiences.
  3. SSL Certificates: To redirect HTTPS subdomains securely, additional setup and SSL certificates for both the source and destination may be needed.
  4. Limited Redirection Types: Depending on your DNS setup, the types of redirects you can use (301, 302, or masked) may be limited.

 

A subdomain redirect can also be set up via your content management system. Below, we’ll discuss how to do this in some of the frequently used CMS systems. (Keep in mind, though, that your CMS needs to be linked to your subdomain in order to be able to do this.)

WordPress

In WordPress, there are a variety of ways to redirect a subdomain. For instance, there are plenty of redirection plugins available to install. WordPress also enables you to connect subdomains to either a separate WordPress.com site, an external site, or a specific non-homepage of your domain. 

Webflow 

With Webflow you can set up a subdomain redirect within the project settings. Webflow offers a step-by-step guide to get you started. 

Wix 

Wix provides a URL Redirect Manager found within the site's dashboard, under the tab for SEO Tools. Here, you can create new redirects by specifying the old and new URLs. Learn more about how to connect a subdomain to an external source in Wix.

What to consider when creating redirects via your CMS

  1. Performance Impact: Implementing redirects directly within a CMS can slow down website performance.
  2. Complexity and Maintenance: Managing a large number of redirects in a CMS can be complex and cumbersome.
  3. Dependency on Plugins: In platforms like WordPress, needing plugins for redirects can pose risks due to compatibility issues, updates, and security vulnerabilities.
  4. Limited Functionality: Some CMS platforms have limited redirect features, lacking options for advanced rules like regex-matching or bulk redirects.

There are also some other methods for redirecting a subdomain. Either through tweaking some settings in your cPanel dashboard or manually by editing your .htaccess file

Via cPanel

You can use the "Redirects" feature in the cPanel dashboard to easily set up redirection for your subdomains to another URL. However, while cPanel is user-friendly, it might not offer the level of control or customization for complex redirection scenarios or specific server configurations.

Via .htaccess

Advanced users can manually redirect subdomains by editing the .htaccess file on their server. This involves adding specific rewrite rules to the .htaccess file to direct traffic from the subdomain to a new location. So you will need to have some coding skills.

What to consider when creating redirects via the .htaccess file

  1. Complexity: .htaccess rewrite rules can be confusing for non-technical users, leading to a higher risk of misconfiguration.
  2. Risk of Errors: Even minor mistakes in the .htaccess file can cause serious problems, such as site downtime.
  3. Server Compatibility: .htaccess only works on Apache servers; for NGINX or other servers, additional configuration or alternative methods are needed.
  4. Maintenance Overhead: Managing numerous redirects in .htaccess can become challenging as the number of rules grows, leading to maintenance issues, conflicts, and performance issues.

What to consider when creating redirects via cPanel

  1. Dependence on Hosting Provider: CPanel features differ among hosting providers, which may limit management options for subdomain redirects.
  2. Limited Control and Flexibility: CPanel is user-friendly but may lack the control needed for complex redirection or specific server configurations.
  3. Performance Overhead: Using cPanel's redirection feature may slightly affect performance as the server processes rules through the control panel's software layer.
  4. Security Concerns: Improper cPanel redirection rules may expose sensitive files, posing security risks.

 

Benefits of using redirect.pizza for your subdomain redirects

It seems like each method has its drawbacks.  But there is a way to go around these limitations. redirect.pizza can help! We’ve listed all of the benefits of using redirect.pizza right below.

Pricing Background
Domain redirects delivered hassle-free

Get started right away

  • Free plan
  • No creditcard required

How to redirect a subdomain using redirect.pizza

You can redirect a subdomain using redirect.pizza. All you need to do is follow these key steps: 

  1. 1

    Step 1: Create a redirect.pizza account

    Create a redirect.pizza account. Once you've created the free account, you can access our redirect features. 

    registration page redirect.pizza

  2. 2

    Step 2: Create redirect

    After signing up, click on "create a redirect" to get started. In the create a redirect window, enter the source URL (such as the subdomain) and the destination URL (where the subdomain will be redirected to). Learn more in our getting started guide

    Create redirect

  3. 3

    Step 3: Adjust DNS settings

    The required DNS change pops up. Go to your domain registrar to make this DNS change for the A record. Alternatively, you can use our Automatic DNS feature to make these changes. It may take up to 24 hours for the DNS changes to propagate. 

  4. 4

    Step 4: Test your redirect and keep track of your analytics

    Type your (old) source URL in the address bar of your browser and click "enter". Are you redirected to the destination URL? Then the redirect is working! You can keep track of your redirect using the Redirect Analytics window. Are you experiencing issues? Check out our redirect troubleshooting guide