1. Home
  2. Web Content
  3. Subdomain fall-through behavior

Subdomain fall-through behavior

Overview

Subdomains created within the control panel via WebSubdomains will map to corresponding document roots. Subdomains not explicitly defined under Web > Subdomains, called a fall-through, will always serve content from your primary domain located under /var/www/html.

Example: assume web.mydomain.com maps to /var/www/web, and mydomain.com is the main domain that serves content from /var/www/html. “web” is the only subdomain associated with the account.

  • http://web.mydomain.com will serve content from /var/www/web
  • http://www.web.mydomain.com will serve content from /var/www/web
  • http://mydomain.com serves content from /var/www/html
  • http://weeb.mydomain.com or http://adkjsdhfksaewfiujohewiuiu3b4iubfuidjnkv.mydomain.com will serve content from /var/www/html (fall-through behavior)

Solution

To stop this behavior, create a .htaccess file under /var/www/html with the following lines:

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

Substitute mydomain.com with your actual domain name.

Updated on July 8, 2019

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help! If you get an error, visit https://lithiumhosting.com/support instead.
Contact Support