Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have files in my site root, and also files in its "Iternet_IE" directory. I need to:

1.) be able to call/include other files (e.g. headers or footers) from within files at either of those locations... using the same path in the include/link, etc. ... e.g. with a prefixing / in the include path, where those include files are located in the site root.

The catch is that I also need:

2.) any incoming traffic using our sharpedge. subdomain to auto-load from the Internet_IE directory - which is one level deeper than the site root (without Internet_IE being specified in the URL).

In an attempt to accomodate these 2 requirements, I have set the DocumentRoot for both the main domain and the subdomain to the site root:

I have this in httpd.conf:

[snip]
NameVirtualHost 11.22.33.44

<VirtualHost 11.22.33.44>
    Options All +ExecCGI
    ServerAdmin hostmaster@ourhost.com
    DocumentRoot /var/www/html/ourdomain.com
    ServerName ourdomain.com
    ServerAlias www.ourdomain.com
    DirectoryIndex index.htm index.html index.dna
    #---------------------------------
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    </IfModule>
    #---------------------------------
</VirtualHost>

<VirtualHost 11.22.33.44>
    Options All +ExecCGI
    ServerAdmin hostmaster@ourhost.com
    DocumentRoot /var/www/html/ourdomain.com
    ServerName  sharpedge.ourdomain.com
    DirectoryIndex index.htm index.html index.dna
    #---------------------------------
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    </IfModule>
    #---------------------------------
</VirtualHost>
[snip]

...and I am trying to use a RewriteRule in .htaccess to effectively cause traffic using the sharpedge. subdomain to auto-load from the Internet_IE directory:

this is in .htaccess (in the site root, here: /var/www/html/ourdomain.com/) :

Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond   %{HTTP_HOST} ^sharpedge\.ourdomain\.com$
    # years ago this next line was used here, but in httpd.conf: (I don't know what it was supposed to do)
    # RewriteRule   ^(.+)        %{HTTP_HOST}$1          [C]
    RewriteRule   ^sharpedge\.ourdomain\.com(.*) /var/www/html/ourdomain.com/Internet_IE/$1  [L]
</IfModule>

..but nothing happens from the RewriteRule; it is as if the RewriteRule was not there. Why?

Or is there another/better way I can meet the 2 requirements I list at the top, above the code snips.?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

this did it:

RewriteCond %{HTTP_HOST} ^sharpedge\.ourdomain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/Internet_IE/
RewriteRule ^(.*)$ /Internet_IE/$1 [L]

Thanks goes to: http://stackoverflow.com/a/11744085/530006

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.