We set up SSO with Auth.Provider in Salesforce. We deployed My Domain and linked the auth provider to it. When a user navigates to the My Domain URL, they are automatically redirected to the auth provider for sign-in.

I created a custom URL to redirect to My Domain, but quickly realized that a redirect cannot be sent to a My Domain (instead of going to the My Domain page, it goes to test.salesforce.com).

My auth provider cannot set up a unique page for our SF environment.

If we want a custom URL that redirects to My Domain, can we set it up through SF



1 Answer 1


You can create a Site and add a redirect from a Site URL to a destination. The destination can be any relative or absolute URL, including a MyDomain URL.

Out of the box, the hostname of the site will be auto-generated and added to a DNS for you by Salesforce. You have an option of using your own, custom domain controlled by your own DNS instead of having the Site default to blah.force.com. While this is technically possible, you'll need to jump through a lot of hoops. It is much easier to stick with an auto-generated Site hostname.

  • So I created a site /login and I'm trying to redirect my /login page to my My Domain page but it isn't working. Am I missing something? ---- Source URL: /login, Target URL: test--Partial.cs29.my.salesforce.com
    – user78286
    Feb 3, 2020 at 21:48
  • Looks right. How does it not work?
    – identigral
    Feb 3, 2020 at 21:55
  • 1
    No, it takes effect immediately. Make sure your Site and redirect are both active (there's an Active checkbox) and nothing else is mapped to /login
    – identigral
    Feb 3, 2020 at 22:01
  • 1
    Might be a sandbox vs prod issue. Try it in a Production org (Developer Edition orgs are Production)
    – identigral
    Feb 3, 2020 at 23:34
  • 1
    If force.com -> My Domain works but custom URL -> force.com -> My Domain doesn't work, it's likely an issue with the first hop but might be something else. If you think it's a Salesforce issue, post a new question. Non-Salesforce issues are best asked on Stack Overflow or another SE, perhaps Webmasters or Information Security
    – identigral
    Feb 5, 2020 at 23:10

You must log in to answer this question.

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