Lighttpd redirect rule for CDN (RegEx help)
I've set up a CDN for image caching on a web site on my Linode running Lighttpd. I need a redirect rule for the images directory - but RegEx isn't my strong point. I wonder if someone could point me in the right direction?
I'd like to redirect all contents (including one level of nested directories and their contents) in the images directory on the subdomain www to the equivalent on the cdn subdomain - basically:
The format for Lighttpd redirects is:
url.redirect = ( "RegEx" => "redirect_url" )
and I've been playing (unsuccessfully) with something like:
url.redirect = ( "^
Any pointers gratefully received.
Note: in order to stop a redirect loop I had to redefine the host specific to the subdomain (www) - so my host config looks like this:
$HTTP["host"] =~ "
server.document-root = "/var/www/mydomain.com/public_html"
server.errorlog = "/var/log/lighttpd/mydomain.com.error.log"
url.redirect = ( "^/images/(.*)$" => "