I am trying to deny access to a sub-domain directory from people accessing directly rather get them to browse to the sub-domain directly. For e.g I want people to be able to go to http://test.example.com and not http://example.com/test. If they do show a 403 Forbidden error. Is this possible through htaccess ? Googled it but cant see anyone doing this. The main purpose being to disallow them from accessing the contents directly. Tried the following to no success.
<Directory /test>
Order Deny,Allow
Deny from all
Allow from .example.com
</Directory>
You can do a permanant redirection from
example.com/test/totest.example.com. This will make sure everyone visit your site undertest.example.com. This would be more appropriate for your users.If you really want to show a 403 Forbidden, you can do this