Overview
Subdomains created within the control panel via Web > Subdomains 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.