A
A
Alex_Ny2014-12-20 22:34:14
htaccess
Alex_Ny, 2014-12-20 22:34:14

How to disallow subdomains via htaccess (subdomains refer to the main domain)?

Shared hosting is configured so that all subdomains point to the main domain folder.
This domain is multisited (for subdomains).
In reality, there are several subdomains. Is it possible to disable (for example, issue 404) all subdomains through htaccess except for a few necessary ones?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-02-25
@ShamblerR

redirect
rewrite cond if not sub domain1
rewrite cond if not sub domain2
rewrite cond if not sub domain3
rewrite cond if not sub domain www
rewrite cond if sub domain (.*)
then redirect (.*) to 404.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question