Вопрос

There is a webserver which has example.com, www.example.com, my.example.com, shop.example.com, static.example.com. All sites except www.example.com is on https. My problem is when I type randomstring.example.com -> shop.example.com gets served. But I want nothing to be served. For example mail.google.com is a valid subdomain. if you type johndoe.google.com you see "This webpage is not available". How to achieve this via Vhost/.htaccess file.

Это было полезно?

Решение

  1. It's not the part of apache. You should disallow DNS resolving for subdomains like *.example.com. or
  2. If you don't have access to the DNS server - you can create a virtualhost with blank index page and put this virtualhost directive on top of the all virtualhosts. It shouldn't be same as google's behavior (they are using 1st way), but at least you can protect shop.example.com visiting from randomstring.example.com
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top