Can you provide more details? I just tried it out and didn't have a problem. I went to the server settings and set Enable URL Rewriting to YES, then I installed the official Pages extension, used it to create a page (Test Page 1), and went to that page. I then clicked the Login link, logged in, and afterward was successfully returned to Test Page 1. Next I clicked the logout link and was immediately returned to Test Page 1. I then disabled the Enable URL Rewriting to see how that worked and it worked the same except that instead of primeloginreturn/test-page-1 in the URL it was primeloginreturn/app.php/test-page-1.