Don't mess with the automatically detected site_url.
The problem is that your login form is on domain.com, while once you log in it accesses www.domain.com (or perhaps vice versa). For SESSION purposes, domain.com and www.domain.com are two different domains. Technically www.domain.com is a subdomain of domain.com.
The .htaccess rewrites don't have any effect on the /manager/ directory. See the line
RewriteRule ^(manager|assets|js|css|images|img)/.*$ - [L]
What you need to do is decide which domain you want to use, domain.com or www.domain.com and uncomment the appropriate lines in the .htaccess file. Also, check your DNS records to make sure that www.domain.com is a CNAME record pointing to either domain.com or the IP address for domain.com.
Then access the login form with the domain or subdomain you've chosen to use. Check the URLs in the address bar to make sure you're getting the same one. Once you're logged in, be sure to clear the cache and make a change to the system settings so that cache will also be cleared. You can manually empty the /assets/cache/siteCache.idx.php file if you want to; MODx will re-generate it.