I don't know under Apache, but under IIS you can run PHP as CGI or ISAPI. In my case PHP had to run under ISAPI, otherwise I was returning also to the login page. It has something to do with the sessions that are lost when you redirect, but I don't know the details.
You can activate roundcube to a logging level 8. See the config file, first parameter.