I found a really useful GIST from Scott Phillips which helps me each time I come to write an htaccess file.