0

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

2 Answers 2

2
+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]
1
  • That is what i need. Thank you (and joschi too)!!!
    – jab
    Sep 16, 2009 at 12:28
0

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]
2
  • That rule seems to provoke a redirection (returns a 302 code) that provokes a new GET
    – jab
    Sep 16, 2009 at 9:08
  • Of course you are right. I forgot the P flag to proxy the request. See Gumbo's answer.
    – joschi
    Sep 16, 2009 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .