TL;DR: Is there any way to have a domain's sub-directory
http://company.com/subdirpoint to a directory outside the web root using only
.htaccesswith no access to the server's configuration?
I have a web site
company.com that runs three country-specific copies of a CMS on a shared hosting package (Apache 2, PHP 5).
The CMS is split into two directories:
/app <----- Non-public content, to be placed outside the web root /htdocs <----- Public content
I would like to have each of the three country-specific CMSes as sub-directories to the main domain:
www.company.com/de/ <-- 1st copy www.company.com/ch/ <-- 2nd copy www.company.com/at/ <-- 3rd copy
the obvious problem with this structure, each CMS's
/app directory would need to be put into a separate location outside the web root. However, for maintenance reasons (I am passing on my projects to another company) I would like to prevent this.
The ideal solution for me would be that each copy of the CMS resides in a directory outside the web root:
/htdocs <------- public web root /de/app /de/htdocs /ch/app /ch/htdocs /at/app /at/htdocs
thus ensuring that the
app directory can't be accessed from outside.
Each CMS's public
htdocs directory would be made available to the world selectively using an
Alias /de ../de/htdocs Alias /ch ../ch/htdocs Alias /at ../at/htdocs
But this is not possible from within
.htaccess (I get a 500 error) where
Alias directives are not possible to specify, and as far as I know,
mod_rewrite directives can only specify targets inside the web root (correct?)
As far as I can see, what I want to do is impossible to do in a shared hosting environment, but I thought I'd check whether anybody here has any ideas, as it would be a huge relief for me to be able to do it this way.
I can put a .htaccess into the parent directory (one level above web root), but that doesn't seem to change anything.
I hope it's put clear enough. If it isn't, please let me know and I will clarify.
Switching away from the shared hosting is not an option, neither is asking the hosting company about relaxing the rules - they are very good at what they do, but also very strict and conservative about individual customizations.
app directory in the web root, and blocking access to it using
Deny from all or similar, is not an option either.