Try changing the RewriteRule to
RewriteRule ^/(.*)$ /index.php/accounts/%1/$1 [PT]
This will rewrite the URL for one, which includes the subdomain and the original URI request.
EDIT: maybe it should be
RewriteRule ^(.*)$ /index.php/accounts/%1/$1 [PT]
as stated in the comments.
source share