Using mod_rewrite to rewrite a URL to lowercase

While moving some of our download URLs to Amazon’s S3 service we came across the problem, that some of the URLs out there use mixed case (which was no problem with our windows servers, they ignore uppercase/lowercase in URLs) while Amazon’s S3 is case senitive.

We needed to rewrite all our URLs to lower case before redirecting the downloads to S3.

Here is the trick:


RewriteMap lowercase int:tolower
RewriteRule ^/download/(.*) http://your-bucket-at-amazon.domain/download/${lowercase:$1} [L,NC]

Advertisements

A few jQuery links

Today just a short list of a few links for jQuery that I came across recently:

  • farbtastic: jQuery plug that can add one or more color picker widgets into a page through JavaScript. It uses layered transparent PNGs to render a saturation/luminance gradient inside of a hue circle. No Flash, no pixel sized divs.
  • jGrowl jGrowl is a jQuery plugin that raises unobtrusive messages within the browser, similar to the way that OS X’s Growl Framework works.
  • markItUp! Universal markup editor is a JavaScript plugin built on the jQuery library. It allows you to turn any textarea into a markup editor. Html, Textile, Wiki Syntax, Markdown, BBcode or even your own Markup system can be easily implemented.
  • MyJUI looks promising in the demo (click the link), but there are no docs or downloads available yet.
  • Superfish is an enhanced Suckerfish-style menu jQuery plugin that takes an existing pure CSS drop-down menu (so it degrades gracefully without JavaScript) and adds enhancements.
  • jTip a jQuery tool tip solution.
  • Visual jQuery is a nice interactive API browser for jQuery.

How to Play a Sound from a Web Page

This one works for IE7, FF3, Safari, Chrome:

<embed src="/sounds/beep.wav" autostart="false" width="0" height="0" id="alarmsound" enablejavascript="true">
<script type="text/javascript">
//<![CDATA[
function playAlarm()
{
var thissound=document.getElementById("alarmsound");
thissound.Play();
}
setTimeout("playAlarm()",1000);
//]]>
</script>

From Demonstration of Different ways to Play a Sound from a Web Page