URL Rewriting - ProxyHTMLURLMap

Hi

I am trying to write a virtual host rule (Apache) to rewrite URLs contained within html.  What I am trying to do, is to automaticaly direct URLs for directories containing static files - eg. www.mysite.com/css/ to a domain specificaly set up to server static content (eg. static.mysite.com/css/

I have tried version permutations of:

<Location /css/>
 ProxyHTMLURLMap /css/ http://static.mysite.co.uk/css/
</Location>

But it doesn't work.  The tags being serviced are eg: /css/main.css which I would like to be rewritten to static.mysite.co.uk/css/main.css before being served up by Apace.

My reason for doing this is to get static content served by nginx and from a cookie free domain, but without too much messing around with the development environment (cakephp)

Hope you can help..

Richard
richp10Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ahoffmannCommented:
# either use redirect
RedirectMatch /css/(.*)$ http://static.mysite.co.uk/css/$1

# or use Rewrite
RewriteCond %{REQUEST_URI} !^/*css/
RewriteRule /css/(.*)$ http://static.mysite.co.uk/css/$1
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
richp10Author Commented:
Many thanks.  

The second solution 404'd on me.  I think the first one led me to an acceptable solution.  I think the redirectmatch provides a  temporary redirection, I also tried:  

Redirect permanent /css/ http://static.mysite.co.uk/css/ 

I think this is working.

What I was trying to do with ProxyHTMLURLmap was re-write urls embedded within the returned html - so the actual requests from the browser went direct to the static.mysite.. domain.  I think the only cost of the redirect is a single request which returns a 304, and after that requests will go direct to the static domain...  

If there is anyone lurking that thinks there is a better way of doing this (or thinks I have my reasoning wrong) please speak up quick - or I am minded to accept the proposed solution as close enough..


Thanks again aHoffman



0
ahoffmannCommented:
> .. was re-write urls embedded within the returned html
for that you need a sophisticated output filter, you better fix your web site for that ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.