RewriteEngine On
RewriteRule ^product/(.*)/$ details.php?id=$1 [NC,L]