How to we achive a 403 Permissions Denied for a subdomain

.htaccesssubdomain

We have a multisite installed in the root directory (multisite.com) and also a wordpress single installation on a subdomain (help.multisite.com)

In the root .htaccess we placed:

#START Security: Disallow access to folders
Options All -Indexes
# END Security

On the main site (as expected we get)

"403 Permission Denied.
You do not have permission for this request /wp-content/blogs.dir/83/"

Nice. 🙂

BUT. We just noticed that when trying to access the subdomains folders we get:

Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request…. Additionally, a 500 Internal Server Error error…

This is something we do NOT want.

So the question is:

How can we avoid the above result and make the message for the subdomains be "403 Permission Denied" (the same as for the main site and NOT "500 Internal Server Error" (as it is now)? We put what, where?

Best Answer

I finally found the answer to my own question

After being puzzled for quite a few many days, someone else (outside these forums) provided the answer. It is quite simple actually. The only action one has to take is to omit the word: All

#START Security: Disallow access to folders
Options -Indexes
# END Security

The best thing is that if (as we did) you place the above in the root directory it "takes care" of all (if any) directories in all subdomain you may have in your server as well. !!!

For those who want to know: The reason why the first attempt (Options All -Indexes) does not work is because the .htaccess file applies rules to the directory that it's in, so you must NOT include that directory again.

The funniest thing is that we've been trying to convince our host to give us an answer to this for the last three days and all they would come up with was "We are sorry. We DO NOT support this kind of questions". They claimed that "this is a specialized to Wordpress software rule", although we kept telling them it has nothing to do with Wordpress itself, but with the configuration of the server.

Anyway... Problem solved. :)