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

I have a web site hosted in a CentOS 5-Plesk-Apache server. I have recently added a second site to the server for serve dynamic content. I have established rewrite rules for images (static content) that works pretty well. The module rewrites the URI in the static server to pointing to the the original file.

The problem is that the first site has the minify (http://code.google.com/p/minify/) script installed but i cannot realize how to write a modwrite rule that works, so if I have:

<style src='http://www.mystaticserver.com/min/f=style.css'>

somewhere, this becomes in the file with this URL

http://www.myserver.com/min/f=style.css

Any ideas? Thank you in advance

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted
+100

If you don’t want a redirect, you could use a proxy to request that resource internally and pass just the response to the client:

RewriteEngine on
RewriteCond %{HTTP_HOST} =static.example.com
RewriteRule ^/min/f=.+ http://www.example.com%{REQUEST_URI} [P]
share|improve this answer
    
That is what i need. Thank you (and joschi too)!!! –  jab Sep 16 '09 at 12:28
add comment

You could easily use either mod_alias's directive RedirectMatch or mod_rewrite for your problem.

A possible rewrite rule (untested) could be:

RewriteEngine on
Options +FollowSymLinks +SymLinksIfOwnerMatch
RewriteRule /min/f=(.*)$ http://www.example.com/min/f=$1 [L]
share|improve this answer
    
That rule seems to provoke a redirection (returns a 302 code) that provokes a new GET –  jab Sep 16 '09 at 9:08
    
Of course you are right. I forgot the P flag to proxy the request. See Gumbo's answer. –  joschi Sep 16 '09 at 11:04
add comment

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.