Basically I want to create a situation where files served from my /cdn directory to use my cdn host rather than the local host.
How can I do this with apache rewrite?
I tried this but it doesnt work =/
RewriteEngine On
RewriteBase /cdn
RewriteCond %{HTTP_REFERER} ^.*\.dev\.*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*\.qa\.*$
RewriteRule ^/cdn/(.*) http://www1.mycdn.com/$1
RewriteEngine Off
RewriteRule ^/blog/(.*)$ /newblog/$1which can be adapted toRewriteRule ^/cdn/(.*)$ http://cdn.example.com/$1– Chris S Apr 14 '11 at 17:50Redirectdirective; eg.:Redirect /cdn http://cdnhost/path/to/redirect– Shane Madden Apr 14 '11 at 18:01RewriteBasechange and theRewriteEngine Offwill both break it, and the regex conditions won't match any valid hostname (the way you have it makes the host end with one or more.s). All you need isRewriteEngine OnthenRewriteRule ^/cdn/(.*) http://www1.mycdn.com/$1 [R]. Alternatively, theRedirectthat I suggested above will do the same thing. – Shane Madden Apr 14 '11 at 18:50