Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have the following code in the .htaccess file located in the root of some subdomain, for instance, http://demo.example.com:

RewriteEngine on

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

When someone access http://demo.example.com, 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

1 Answer 1

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

 
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.