I would like to know if we could customize Partner Portal login URL to some formal URL (like we have for login.salesforce.com) or is it fixed to the standard login URL?

"https://ap1.salesforce.com/secur/login_portal.jsp?orgId=ORG ID&portalId=PORTAL ID"

  • possible duplicate of Customize Partner Portal Home Page Layout
    – crmprogdev
    Commented Sep 18, 2014 at 18:41
  • @crmprogdev this one is for "Customizing the Login URL" as this URL seems to be bit lengthy and is there a way to customize this URL.
    – Sapthagiri
    Commented Sep 19, 2014 at 20:57
  • Yes, and in the referenced post, I recommended you look at the log-in controller to see what it pointed to. There's also a log-in page that should be specified in your portal set-up which is like a detail page. Have you looked at your log-in controller to see if it points to that page? My point in marking this as a duplicate is that its a follow up to your original question which could have been edited or commented.
    – crmprogdev
    Commented Sep 19, 2014 at 21:10
  • @crmprogdev What I am looking is to "customize" the login URL. Basically, I need something of a simpler version like community.mydomain.com which apparently shows the users the login form and when logged in would show the normal Salesforce Home tab. So, I would like to know if this is possible and if so, how can I implement it.
    – Sapthagiri
    Commented Oct 8, 2014 at 5:57
  • @crmprogdev And my previous question was on how to customize Partner Portal Home Screen (which we see after logging into the Portal) while this question is to know if I could customize the login URL (which at the moment is very lengthy with OrgId & PortalID). And so, I had to come up with two different questions rather than combining in a single one.
    – Sapthagiri
    Commented Oct 8, 2014 at 8:38

2 Answers 2


The Portal Login Controller uses the SiteLoginController which you can find by going to Develop > Apex Classes > SiteLoginController. It can be edited directly from there to add any custom functionality that you desire.

There are other modifications that Set-up will automatically make to it for you if you go to Customize > Customer Portal > Settings.

You can also make changes to a number of basic settings by clicking on the Edit button next to where it says Customer Portal or whatever you've named your portal. Note that a Partner Portal is merely a Customer Portal with a different license that enables more features. The screen capture below shows some of what you'll see and that you can do.

Customer Portal Edit Screen

If instead, you click on Redirect to HTTPS Login Pages for All Portals and it will open an edit page that looks like the one below. After clicking on the Edit button for each portal in your org, you can enable the checkbox to require the use of https at log-in. Doing that will automatically update the startURL used by the controller to an https address for you.

Portal HTTPS Login Page Edit Page

Below is what the code looks like for the basic SiteLoginController:

 * An apex page controller that exposes the site login functionality
global with sharing class SiteLoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        String startUrl = System.currentPageReference().getParameters().get('startURL');
        return Site.login(username, password, startUrl);

    global SiteLoginController () {}

You can directly edit the code above to add additional functionality, including redirecting the start URL to a custom page. Be aware that If you also use sites in addition to your Partner Portal, this could create an issue for you.


You can redirect the StartURL to a custom VF page. There are several different ways of doing that. Some involve JS, others involve hardcoding the StartURL into the controller and others involve creating a custom log-in page that assembles the redirect (you can add custom branding to it while you're at it).

In essence, there are many different ways of doing this, but each has its drawbacks and some can affect your entire portal. For example, if you redirect your Portal to a custom VF page, your entire Portal will then need to use VF built around the template for that Start page as it will no longer follow the standard tabbed template or be able to use the headers and footers defined in the Portal Configuration Page shown above.

Here are some links you should find helpful: Embedding Partner Portal login page in visualforce Page (see the post at the very bottom of the page), How do I use a custom URL for the Customer Portal, Partner Portal Direct User to Alternate page after Site.login, and Default Landing Tab.

Many of the solutions revolve around some variation on creating a means of assembling a pageReference in the log in controller as in the method below, where they explicitly set the StartURL and then set the redirect as true upon successfully obtaining valid credentials for the user:

global pageReference login()

  String startUrl = '<a href="https://na6.salesforce.com/secur/login_portal.jsp';" target="_blank">https://na6.salesforce.com/secur/login_portal.jsp';</a>
  startUrl += '?orgId=00Dxxxxxxxxx&portalId=060yyyyyyyyyy&loginType=3';
  startUrl += '&startUrl=';
  startUrl += '&loginUrl=';
  startUrl += '&useSecure=true';
  startUrl += '&un=' + username;
  startUrl += '&pw='+ password;

  PageReference portalPage = new PageReference(startUrl);
  PageReference p = Site.login(username, password, startUrl);

  if (p == null) return Site.login(username, password, null);
  else return portalPage;


Edit 2

For "myportal.mydomain.com" URL log-ins, these links may be what you're looking for: Custom Login Page and URL - what was delivered?. You might also want to look at customized-salesforce-customer-portal and OAuth for Portal Users. I've included the latter because it appears that using OAuth instead of a CNAME is necessary if you don't want your Salesforce instance to suddenly appear in the path once your user has logged in to your secure portal or potentially have them receive certificate mismatch warnings from their browser.

  • @cmprogdev I was wondering if there could be some settings available in Salesforce where I could provide the desired web URL and redirect it, which I am not sure though. From the above comment of yours, I was thinking how we could redirect the Start URL.
    – Sapthagiri
    Commented Nov 17, 2014 at 7:01
  • Yes, you can redirect the StartURL to a custom VF page. There are several different ways of doing that. I'll edit my post with some links to other posts that describe different methods for doing it. Some involve JS, others involve hardcoding the StartURL into the controller and others involve creating a VF log-in page that assembles the redirect. Many different ways of doing it, but each has its drawbacks and can affect your entire portal.
    – crmprogdev
    Commented Nov 17, 2014 at 15:04
  • I guess, you must be reading my post/comments wrong, because, I wanted my community portal URL to be as community.mydomain.com (as of now, we have got the traditional URL: ap1.salesforce.com/secur/login_portal.jsp?orgId=ORG ID&portalId=PORTAL ID ) , where I would have a login page, which upon logging in would take me to the regular Home tab, but the replies that you gave looks to show for the actions that are to be taken after logging into the portal.
    – Sapthagiri
    Commented Nov 18, 2014 at 8:11
  • See my edited response above
    – crmprogdev
    Commented Nov 18, 2014 at 14:58
  • I found the solution for my post and it is just creating a CNAME record with domain registry.
    – Sapthagiri
    Commented Dec 8, 2014 at 9:57

we just need to add a CNAME record at out Domain registry and point it to Salesforce. So, whenever we open our website like www.example.com, it would open the Community portal login page. The following is the CNAME record format: www.example.com.OrgId.live.siteforce.com where www.example.com would be your domain and OrgID would be your Salesforce Org Id.

You must log in to answer this question.

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