I have an url localhost/viewprofile.php?username=johngood23
and I want it to rewritten as johngood23.localhost
using htaccess.
This is what I tried but failed to do so.
RewriteCond %{HTTP_HOST} ^www\.localhost\.com [NC]
RewriteRule ^(.*)$ viewprofile.php?username= $1