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

This is a follow-up question to my previous question on this site. Maybe I should point out that the Apache server is running on a windows system, don't know if it matters.

My problem is following:
I have 2 drives J: and K:, both have a directory test (J:/test/ and K:/test/)
J:/test/ contains the file pink.html
K:/test/ contains the files red.html and blue.html
I want to access all files in J:/test/ and K:/test/ with the the same url:

This is an excerpt from my httpd.conf file:

Alias /test/ "J:/test/"
Alias /test2/ "K:/test/"

<Directory "J:/test/">
Order allow,deny
Allow from all

Options All MultiViews
AllowOverride None

RewriteEngine on

RewriteCond /test/%(REQUEST_FILENAME) !-f #if we can't find the file in /test/
RewriteRule ^(.+) /test2/$1 [L]   #rewrite url into /test2/something.html

RewriteCond /test/%(REQUEST_FILENAME) -f #if we find the file in /test/
RewriteRule ^(.+) /test/$1    #should this even be necessary ?


This works only partially, i can access red.html and blue.html at the K: drive but not pink.html on the J: drive. It seems to totally ignore the 2nd RewriteCond-RewriteRule pair. How do I configure httpd.conf to access pink.html?
I have tried several approaches but to no use :-( I hope my question is clear and that someone could shed some light on this matter.
Thanks in advance! /Alex

share|improve this question
For consistency you could try making aliases for /test1/ and /test2/ and redirecting accordingly. – Gleb Oct 2 '09 at 15:30

Try this,

RewriteRule ^(.+) /test/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/test/(.+) /test2/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/test2/(.+) /test3/$1


RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/test1E+10/(.+)$1 [L]
share|improve this answer

Under Linux you could do this at the filesystem level as there are several filesystems that support unioning other filesystems this way (even in read+write mode) but I don't think there is a way of doing this in Windows.

Another option, again at the OS level rather than Apache, might be to bring all the files into one place as symbolic links. This is possible under Windows if you are using NTFS filesystems using utilities such this one from SysInternals.

share|improve this answer

You shouldn't need the second RewriteCond/Rule combo, as basically you're trying to tell Apache to do the same thing it would do anyways. Basically the default action if a file is found where it was asked (/test/pink.html) is to serve it up to the client.

I would move those Rewrite* outside your Directory construct; that container is more typically used for access restrictions, what you're doing is a logical redirection. After moving the Rewrite* out and getting rid of the second stanza, edit your RewriteCond to use {} and not () characters as that is the appropriate way it's done.

If after all this it's still not working, add these two lines:

RewriteLog "c:/rwlog.txt"
RewriteLogLevel 7

...restart Apache, test and go read the log file to figure out what next Apache doesn't like.

share|improve this answer

Your Answer


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.