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

I have the following code in the .htaccess file located in the root of some subdomain, for instance,

RewriteEngine on

RewriteRule ^$ /admin/index.php?q=user/nazgulled [L]

When someone access, they will be redirected to the URL above. Which is an HTML page. But this HTML page is using relative address for things like images, CSS code and JavaScript code. They are not working because it cannot find the files in the current directory (subdomain root). They are located on the "admin" folder.

How can I make this work changing only the .htaccess file?

share|improve this question
up vote 1 down vote accepted

Can you add something like this above that line?

RewriteRule ^/(.*\.css)$ /admin/$1 [L]

This is just a guess, but it sounds like you're needing to re-map the things back from the "root" into your path. I think, though, you're headed down a path of hacks. You'd have to do the same thing for .js, then likely images, uploaded files, etc. I suspect it may be faster to change the HTML to map to where they really live.

share|improve this answer
It's actually just 2 files really. It's just that I don't want to mess with the source code because I would need to change it whenever I upgrade to a newer version. I had to adapt your solution RewriteRule ^/?(html/\w+\.(js|css))$ /admin/$1 [L] but it worked :) – Ricardo Amaral Jan 17 '10 at 2:02

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.