I have a situation, Whenever a customer is trying to access an inside page of the community while his/her session is not active. As a default functionality Url has to direct to the login page of the community. But in my situation Url is appending the path of the force.com site to the community URL and resulting in showing a broken page.

Any thoughts/ debugging ideas will be helpful.

  • Post the controller code for the inside page and login page please Commented Jun 10, 2015 at 16:45
  • Hi Brian, Here is the code. global PageReference forwardToCustomAuthPage() { PageReference pa=dispatch(); return pa;} public PageReference dispatch() { PageReference page = null; if (communityId == ''){ communityId = Network.getNetworkId();} if (communityId != null) { Network community = [Select n.UrlPathPrefix, n.Status, n.Name, n.Id From Network n Where n.Id = :communityId ]; if (vfPage != null) { page = new PageReference('/' + community.UrlPathPrefix + '/' + vfPage);} return page;}} Issue is when another custom URL is defined, How we can pic that instead of default force.com one.
    – Dinesh KR
    Commented Jun 11, 2015 at 20:27

2 Answers 2


You need to give access to this Visualforce page [which you are trying to land user on], controller and objects to Site Guest profile and then they will be able to see it without redirection.

  • I'm sure that this is not a permission issue since all the pages which need to be accessed by guest user are assigned appropriately. In this scenario, the issue is when we create a community. It will create a Site with a custom URL (typically like salesforce base URL and path prefix). When we create a new custom URL for the same community and made it as primary, it will work using this new URL. but in my case, when the user is trying to access internal page instead of directing the user to "new custom URL" for login it is directing to "new custom URL+path prefix of the old URL".
    – Dinesh KR
    Commented Jun 10, 2015 at 21:03

This issue got happened because of updating the forwarding method in communitiesLoginController class for the sake of multiple communities in that environment. Typically communities login URL in sandboxes will be like "custom URL+path prefix". While coming to the production each community will have a dedicated published Site URL. So default forwarding method is good. So updated the logic saying if Salesforce base URL is having force.com direct to custom logic else default login. This worked in my case.

You must log in to answer this question.

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