Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my shared hosting, I have just created a new subdomain but it has also create a new folder .

How can I avoid to create these new folders every time I create a new subdomain ?

share|improve this question

migrated from Jul 17 '12 at 4:39

This question came from our site for professional and enthusiast programmers.

I guess the reason why this folder is created is simple. The hosting company just adds a entry into your DNS zone file, something like:

static        A        W.X.Y.Z

where W.X.Y.Z is the IP of your existing site ''. Then they'd creates a virtual host in apache config - and sets its DocumentRoot to <server_path>/public_html/static.

I am sure your problem is not with the folder itself (how else will you organize all the files for static sub-domain if not in a subfolder) but with the fact the files are also accessible via the URL

One solution is that you can ask your hosting company to put the static folder outside your current document root so that it is not addressable as a subfolder of current DocumentRoot.

What I mean to say is that your current directory structure could look like:

- public_html
   - static

where public_html is your DocumentRoot for (couldbe called httpdocs or some other name based on your hosting env)

You need to ask them to move static folder only level up to something like:

- public_html
- static

static is now a sibling of old DocumentRoot and not a child of it. It will be no longer addressable via now. /static is a new DocumenRoot for your new subdomain.

share|improve this answer

On a shared hosting site the hosts software normally does this. I think this is an unintended behavior and you should contact your host provider. It is not normal that a subdomain can be accessed via appending a path to the main domain.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.