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 page:


has relative links, like this:

<script type="text/javascript" src="res/ext-base.js"></script>

The problem is that the directory res/ is not in /subdira/subdirb/ but in another directory (/js/ext-3.3.1/cm). So I'm wondering how to change the basedir (or maybe another solution). So if I try this rule:

RewriteRule ^/$ /js/ext-3.3.1/cm/index.html [QSA,L]

I may now be able to call the "base" url without 'subdira/subdirb/ ' like this:


but... if I do this, this relative link:

<script type="text/javascript" src="res/ext-base.js"></script>

doesn't work anymore because it tries to access the /res/ext-base.js, not the good one.

Any idea how I could do?

share|improve this question
up vote 0 down vote accepted

Ok I found it here:

(Section "Search pages in more than one directory")

I've taken the opposite side: test if the file is in the subdirectory, if so, stop and go ahead:

RewriteCond         %{DOCUMENT_ROOT}/js/ext-3.3.1/cm/%{REQUEST_FILENAME}  -f
RewriteRule  ^(.+)  /js/ext-3.3.1/cm/$1 [QSA,L]
RewriteCond         %{DOCUMENT_ROOT}/js/ext-3.3.1/cm%{REQUEST_FILENAME}  -f
RewriteRule  ^(.+)  /js/ext-3.3.1/cm$1 [QSA,L]

it works \o/

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.