We have configured our salesforce.com crm sandbox with SSO and My Domain so that going to <companyname>--dev.my.salesforce.com automatically redirects the users to our custom login page where they use our company issued credentials to log into salesforce crm.

The problem is that I would like to have our users go to a more friendly url. i.e. salesforce.ourcompany.com. When they hit this url it would automatically direct to <companyname>--dev.my.salesforce.com and show our custom login page. We are just setting up a simple CName alias in our internal DC (for testing) but when we do this, we always are redirected to the actual sandbox instance.

Any ideas on how to setup a simple CName to do this or is there a salesforce configuration step I'm missing?

  • When you say "automatically direct to [URL]" what does this mean to you as far as the browser's behavior? Do you want the user's browser to keep salesforce.ourcompany.com for all requests from that point forward (both secure and unsecure) or is the friendly URL just for convenience on the first request?
    – Mark Pond
    Commented Jan 24, 2015 at 0:33
  • @MarkPond - thanks for the reply. The expected behavior would be to redirect the browser to the *.my.salesforce.com domain url. Just a standard CName alias for convenience.
    – UT-Fan-05
    Commented Jan 24, 2015 at 1:16

3 Answers 3


You cannot setup a CNAME to <companyname>--dev.my.salesforce.com. Salesforce will not respect the domain name (host) you use.

If you were to setup a CNAME to <companyname>--dev.my.salesforce.com in DNS you will get redirected to the salesforce domain (losing your vanity URL).

There are a couple of salesforce features that support using a CNAME (Force.com Sites, Site.com, Communities). For those features, there is configuration that you need to do in salesforce in addition to updating DNS> My Domain is currently not one of those features.

One option you have is to use Single Sign On to create a custom login page that you host where users can login to salesforce, but after login they will use the <companyname>--dev.my.salesforce.com URL.


Unless SF provides us a way to map host headers to orgs, I don't see how we can use CNAMEs in that way. When the request hits SF, the host header will be the CNAME's alias, not the target, and so wouldn't know which "my domain" to map to and so wouldn't be able to do any SSO redirect.

My testing, using fiddler to watch the http traffic, shows SF receiving the request and returning a 302 redirect to the normal login page. If that normal login page is all you need, then this work fine.

One option is to have a local web server that redirects to your "my domain" and add an A record to dns for that server. That way, the request that hits SF would have the correct host header and can correctly do the SSO redirect.


Couple things to keep in mind. DNS only resolves the hostname to an IP or in the case of a CNAME an alias for hostnames. What DNS does not do is either hostname redirection such that the client is automatically forwarded from host A to host B based on a DNS record or directory/file redirection such that the client is automatically forwarded from host A to host A/somepage.html.

My recommendation is, provided you have the ability to stand up a simple web server or provision an addition web server instance from an existing web server:

  1. Create a Web Site in Apache or IIS
  2. Set the DNS record to this webserver with your 'vanity' hostname (A or CNAME, which ever floats your boat)
  3. Set your host headers to the 'vanity' hostname
  4. Create the default HTML page in the root so that http://hostname works
  5. Use an HTML redirect to forward the client from the vanity hostname to your SFDC login page. You can of course use PHP, ASP, Javascript, etc. for the redirect, there are a million ways to solve this one but here's one way: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_redirect

I've done this for SFDC Customer Portal such that Customer Service and Marketing can give customers an easy to remember URL to the Portal such as: help.domain.com, portal.domain.com, etc.

If you try 'http://customer.parata.com', this redirects as described above.

You must log in to answer this question.

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