Rewriting URLs for Virtual Video Clips


Virtual Video Clips

We have a full length video available at the following URL 'http://www.example/com/video.mp4'. A preview can be provided by adding the 'start' and 'end' parameters, say for example we want to use 30 seconds of preview starting at the 15th second. We then have the following URL ''.

This will work fine when using wget / curl, unfortunately a lot of Flash players don't behave correctly as they don't allow video URLS with query parameters in them. They just blindly append '?start=xyz' to the URL making it invalid.

To work around this we can move the start and end parameters to the server side configuration. This has a couple of advantages:

  • The user doesn't see the '?start=15&end=45' parameters any more.
  • Flash players assuming that they are adding the first query parameters work again.

So, let's replace the preview URL '' by '' and move the URL rewriting to the server side configuration.


In your .htaccess:

RewriteEngine On

# From:
# To:
RewriteRule ^(.*)/preview\?(start=.*)$ $1?$2&vbegin=15&vend=45 [L]




Last modified 8 years ago Last modified on 05/30/09 18:31:07