---
title: "Subdomain fall-through behavior"
date: "2014-11-01"
category: "web-content"
slug: "subdomain-fall-through-behavior"
---

## Overview

Subdomains created via **Web** > **Subdomains** in the control panel map to their configured [[where-is-site-content-served-from]]. Any subdomain that is not explicitly defined -- called a "fall-through" -- serves content from your primary domain at `/var/www/html`.

## Example

Assume `web.mydomain.com` maps to `/var/www/web`, and `mydomain.com` serves from `/var/www/html`. The subdomain `web` is the only one configured on the account.

- `http://web.mydomain.com` serves content from `/var/www/web`
- `http://www.web.mydomain.com` serves content from `/var/www/web`
- `http://mydomain.com` serves content from `/var/www/html`
- `http://anything-else.mydomain.com` serves content from `/var/www/html` (fall-through behavior)

## Preventing Fall-Through

To block undefined subdomains from serving your primary domain's content, create a [[htaccess-guide]] file under `/var/www/html` with the following rules:

```
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?mydomain.com [NC]
RewriteRule .* - [R=404,L]
```

Replace `mydomain.com` with your actual domain name.
