---
title: "Apache and wildcard domains on Cloud Platform"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn how Apache handles wildcard domains on Cloud Platform. Discover potential routing issues, understand domain matching processes, and find solutions to ensure your website serves the correct content."
image:
type: "page"
url: "/acquia-cloud-platform/apache-and-wildcard-domains-cloud-platform"
id: "3063b0c3-7c31-47e2-b72a-279c898ecaae"
---

Note

*   You can use the wildcard character ( `*` ) to make your environment available for several subdomains (for example, `*.example.com`).
*   Wildcard characters only match a single subdomain level but do not match multiple subdomain levels separated by a dot. For example, `*.example.com` can match against `a.example.com` and `a-blog.example.com` but cannot match against `a.b.example.com` or `a.b.c.example.com`.
    
*   To cover subdomains of various levels, a wildcard is required at the relevant subdomain level. You can use a single wildcard in each record. For example, `*.example.com`, `*.b.example.com`, `*.b.c.example.com` are all legitimate and match against `a.example.com`, `a.b.example.com`, `a.b.c.example.com` respectively.
    

Incoming requests for a domain are first processed by the load balancer, which directs the requests to the proper infrastructure. After the infrastructure receives the request, Apache handles routing the requests to the proper website by matching the requests to the configured site root directory. Unexpected behavior can result when wildcard domains (`*.example.com`) are used.

Due to the way Apache processes domain matching, traffic might be routed to the environment with the wildcard domain, instead of the explicitly-named domain you intended.

Unlike Nginx on the load balancer, Apache processes domain names alphanumerically, in the order they appear in the configuration files, instead of respecting more specific domains before wildcard domains. This ordering can lead to a wildcard domain configured for one environment catching traffic you intended to route to a different environment.

For example, let’s say we have a customer using the [sitename](/definitions/sitename) `delightful` on Cloud Platform Professional. Since Cloud Platform Professional appends random alphanumeric strings to [sitenames](/definitions/sitename), the resulting configuration files would appear like this:

    delightful978inmswak-152457.conf
    delightful82upsouk-168414.conf
    delightfulmlhjfbjppg-154567.conf

These configuration files correspond to the following environments on this infrastructure:

*   Dev = `delightful978inmswak-152457.conf`
*   Prod = `delightful82upsouk-168414.conf`
*   Test/Staging = `delightfulmlhjfbjppg-154567.conf`

Inside each of these configuration files are a set of variables called `ServerAlias`. These variables are the domain names displayed on your **Domains** page. The configuration files mentioned above contain the following `ServerAlias` definitions:

    delightful978inmswak-152457.conf
        ServerAlias dev.delightful.com
        ServerAlias loadtest.delightful978inmswak.devcloud.acquia-sites.com
    
    delightful82upsouk-168414.conf
        ServerAlias *.delightful.com delightful.com www.delightful.com
        ServerAlias dc-278394-136583925.us-east-1.elb.amazonaws.com
        ServerAlias loadtest.delightful82upsouk.devcloud.acquia-sites.com
    
    delightfulmlhjfbjppg-154567.conf
        ServerAlias test.delightful.com
        ServerAlias loadtest.delightfulmlhjfbjppg.devcloud.acquia-sites.com

If a request is received for `test.delightful.com`, the request would be caught by the `*.delightful.com` rule, which Apache reads before the `ServerAlias` for `test.delightful.com`. The content for `test.delightful.com` would appear on the production environment, instead of non-production environment.

It is not possible to circumvent the method Apache handles wildcard behavior in the domain matching process. If you determine that your subscription is serving the wrong version of your website, and you use wildcard domains, try removing the wildcard to attempt to resolve the issue.