The rewrite condition will not redirect requests for / to Cloud Files. This allows you to create an index file. We’re using a 302 temporary redirect (instead of 301 permanent) so search engines will pick up the URLs under your custom subdomain (and not the Cloud Files URL).

Implementation #2

This implementation is similar to implementation #1, except it allows you to have multiple containers so you can segregate your content. For example, this will allow you to have http://cdn.domain.com/images/ and http://cdn.domain.com/files/ going to two different Rackspace Cloud containers.

We’re going to use ‘images’ as our first example.

To get started, create the directory in your subdomain.

In this directory, create a ‘.htaccess’ file that looks like the following:

You will need to replace “/images/“ with the name of your directory, and replace ‘c0918182’ with the ID of your container.

Like implementation #1, the rewrite condition will allow you to create an index file in your directory.

To link additional directories to different containers, simply repeat the instructions with a different directory name and container ID.

Nginx Implementation

If you’re running Nginx, you can accomplish the same effect using locations and rewrites. This will be similar to implementation 2 for Apache. Any file that does not exist in the file (such as an index file, or some arbitrary file you felt like putting there) will be served off of the CDN.

In your Nginx config, you’ll create a new server directive for your subdomain as well the location block for your redirects.

There isn’t any billing on the server, just your CDN bandwidth. The server just tells the browser to pull the file from cloud files, it’s not as awesome as a CNAME (they can see the redirects and such) but it’s better then nothing until CNAME support is implemented.

There will be a small amount of inbound bandwidth to the Cloud Server, when it receives the request line and headers (usually somewhere around 500 bytes per request), but as Ryuujinx said, the actual data is being downloaded directly from the CDN, not passing through the Cloud Server.

As for subdirectories, you can have “Fake” subdirectories, the more common file managers support this (See Cyberduck on OSX and Fireuploader if you’re a firefox extension. There’s also a windows manager called Cloud Files manager that’s paid use)

Edit: You don’t technically need the RewriteCond directive as all requests to the directory and any subdirectories are being redirected to the CDN url.

Problem is Google is not indexing any of my site’s images that are server in this way from the Cloud Files.
For example this page:http://www.zibo.ro/planeta-foto/v/Iacob-Rares-Stefan-Zibo-3211
comes first in google search for the kid’s name “Iacob Rares Stefan”.
The main image and all the thumbnails are served with a “302 Found” and none of these come up in Google Image search.
Right now I’m out of ideas. The naming of the files is not SEO friendly but still that can’t be the sole cause for the problem…