On my shared hosting, I have just created a new subdomain static.example.com but it has also create a new folder www.example.com/static/ .
How can I avoid to create these new folders every time I create a new subdomain ?
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:
where W.X.Y.Z is the IP of your existing site 'example.com'. Then they'd creates a virtual host in apache config -
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
What I mean to say is that your current directory structure could look like:
where public_html is your DocumentRoot for example.com (couldbe called
You need to ask them to move static folder only level up to something like:
static is now a sibling of old DocumentRoot and not a child of it. It will be no longer addressable via
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.