From my understanding of your question, this should work.
Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^@(.+?)$ user.php?u=$1 [NC,L]
This requires that you have @ in front of the username and it is passed as the variable GET (u). However, a person may add other characters that may confuse him as a username.
/ @ username / cupcakes
But if you want it and have pages for the username (i.e../@ username / info, / @ username / o, etc.), you can just use explode () in PHP.
If you just want it to get a username and nothing else, you can try
RewriteRule ^@([A-Za-z0-9]+)$ user.php?u=$1 [NC,L]
Hope this helps! :)
source share