I have a very similar setup to this question:
How do I use a custom URL for the Customer Portal
I first access my site through a custom url. I see the login page because that is the active page I set for the site. When I login the browser goes to the front door url, as I can see in the browser history, and then sends me back to my Visual Force login page.
From there, to see if I logged in, I can type in the URL of the portal page I want to go (myportalurl.com/home/home.jsp) and I am authorized. I tried setting my startURL parameter to /home/home.jsp but it still sends me back to my site's Active Home Page where I setup my custom login visual force page.
Is there something obvious I am missing?
Here is the controller:
/**
* An apex page controller that exposes the site login functionality
*/
global with sharing class LoginController {
global String username {get; set;}
global String password {get; set;}
global PageReference login() {
return Site.login(username, password, '/home/home.jsp');
}
global LoginController () {}
@IsTest(SeeAllData=true) global static void testLoginController () {
// Instantiate a new controller with all parameters in the page
SiteLoginController controller = new SiteLoginController ();
controller.username = 'test@salesforce.com';
controller.password = '123456';
System.assertEquals(controller.login(),null);
}
}
Best Answer
It looks like the problem was some beginner's confusion between the starting url entered into the browser, /apex/SiteLogin url, the VF site active home page, and the unauthorized page. Changing the site active page to a new page avoided the loop where I had mistakenly setup my site's active page to be my login page. Instead I modified the default unauthorized page to have the custom login html. Then I used the starting url in the browser to be the custom name. That seems to lead to the unauthorized page, although the url doesn't change. Then I can login and the startURL parameter redirects to the home page that I was seeking.