Link to home
Start Free TrialLog in
Avatar of scend
scend

asked on

Accessing directories outside of DocumentRoot using .htaccess

Hello all,

I've built a site that utilizes three different URLs, each of which point to a specific directory in my /htdocs folder (accomplished using rewrite in .htaccess).

The pages all reference files which are shared resources (such as .css files). The files exist in a /global directory adjacent to the three directories in question (which places the files within 'outside' of the docroot of each of my three sites). When I go to my URL, the page loads, but none of the shared resources load.

Alias seems to be the method for correcting this issue, but I can't seem to make it work.

Also interesting...my pages run a php include which loads variables and some shared copy that I reference in the page. The include file is also in the /global directory, but these variables and copy load into the page. Which tells me that the php is not affected, but the html is.

Below I'm pasting the rewrite command I currently use in my .htaccess file. It only references one URL as the other two are identical.

Thank you in advance for your help!

Travis

P.S. <UPDATE> I changed the links site wite to be direct and this works (obviously). It doesn't see like the most elegant solution, however.

---------------------

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/membersites/dreamhomesguaranteed/
RewriteCond %{HTTP_HOST} dreamhomesguaranteed.com$
RewriteRule ^(.*)$ membersites/dreamhomesguaranteed/$1 [L]
ASKER CERTIFIED SOLUTION
Avatar of periwinkle
periwinkle
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial