RewriteEngine On

RewriteRule ^ref/([A-Za-z0-9]+)$ register.php?ref=$1 [L,QSA]