RewriteEngine on RewriteRule ^[a-zA-Z0-9]+$ file.php?token=$0 [L,QSA] RewriteCond %{REQUEST_URI} !^.+/.+$ RewriteRule ^ - [F]