Solved

Redirect folder content to CDN using mod_rewrite

Posted on 2010-08-22
3
880 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:adamshields
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:Frozenice
ID: 33496304
ok..

on your script above..

try putting on top line






RewriteEngine On

Open in new window

0
 
LVL 3

Author Comment

by:adamshields
ID: 33496495
It's already on, just didn't include it.
0
 
LVL 3

Accepted Solution

by:
adamshields earned 0 total points
ID: 33498104
I got it to work with just the following rule.

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

Though I'm still wondering why the first two rules did not?
0

Featured Post

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What You Need to Know when Searching for a Webhost Provider
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question