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 = '[email protected]';
        controller.password = '123456'; 

  • It looks like the problem may be the entry point needs to be /apex/SiteLogin and the active home page to be my home page.
    – jlim
    Apr 16, 2013 at 4:46
  • what are you setting the startURL to? Can you post your controller code?
    – Ryan Guest
    Apr 16, 2013 at 19:10
  • thank you for your interest. I've posted the code. I'm new to SF and had some confusion around the different page routings.
    – jlim
    Apr 17, 2013 at 0:41

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .