Link to home
Start Free TrialLog in
Avatar of adamshields
adamshieldsFlag for United States of America

asked on

Redirect folder content to CDN using mod_rewrite

I would like to redirect content that is placed onto our CDN using mod_rewrite. The following rule is not working correctly. I only want content in a specified folder to redirect and not the root or entire domain.

RewriteCond %{REQUEST_URI} !^/dl/$
RewriteRule ^(.*)$ http://c0002.cdn1.cloudfiles.rackspacecloud.com/$1 [R=302,L]

Open in new window


This tries to use the CDN for every file requested and not just the files that would appear to come from the dl folder which is not desirable. Also when going to www.domain.com/dl/file.zipĀ I am redirected to http://c0002.cdn1.cloudfiles.rackspacecloud.com//dl/file.zip, notice the addition of the /dl/

Here is the example I was following: http://se.id.au/journal/files/mosso_cloudfiles_with_own_domain.php
Avatar of Frozenice
Frozenice
Flag of Philippines image

ok..

on your script above..

try putting on top line






RewriteEngine On

Open in new window

Avatar of adamshields

ASKER

It's already on, just didn't include it.
ASKER CERTIFIED SOLUTION
Avatar of adamshields
adamshields
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial