htaccess mod_rewrite not working

With some help (also asked on SO, as this wasn’t a strict WP question), and some testing, the following ended up working for me (added a slash just before the $ sign):

RewriteRule ^galleries/(.*)/$ /portfolio/$1 [R=301,NC,L]

As the galleries are actual directories, not files, they have a slash at the end:

http://subdomain.example.com/galleries/headshots/
                                        Here ---^