rsync interprets a directory with no trailing slash as copy this directory, and a directory with a trailing slash as copy the contents of this directory.
Try rsync -av ~/foo/ user@remote.com:/var/www/bar/
rsync interprets a directory with no trailing slash as copy this directory, and a directory with a trailing slash as copy the contents of this directory.
Try rsync -av ~/foo/ user@remote.com:/var/www/bar/