Hi i am by using this code for my subdirectories redirect for usernames

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ profile.php?username=$1&%{QUERY_STRING}

I've this issue that's user enter domain.com/username/ it'll have problems, it only works when they enter domain.com/username

Any methods to this??

Also, example if i've got a real directory call /images/, once they enter domain.com/images. you will see a mistake regarding some looping problem. what's the method to solve this problem?

It's easier to build your rewrites require trailing slash.

you'll be able to redirect non-slash ended web addresses to slash ended one,

using something similar to this :

RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301]

I really hope this can help.