Widely used third-party integrations with Apple and Android operating systems — such as deep links and payment processors — require verification of site ownership by placing specific files at defined URL paths. These paths typically start from /.well-known/ and contain individual JSON configuration files. Common examples include assetlinks.json (Android App Links) and apple-app-site-association (iOS Universal Links).
With Salesforce, it is not possible to directly serve files at the /.well-known/ path for any site. Salesforce pre-populates some endpoints at these paths. However, using Salesforce URL Rewriters, you can present a Visualforce page to the integration service that appears to be served from the correct path while actually being a Visualforce page hosting the required JSON content.
Note: This approach generates a redirect, so it does not work with services that do not follow redirects or that require a 200 OK status code to be returned directly.
Create a Visualforce page to host your required JSON content and give it a descriptive, unique name. Set the contentType attribute appropriately for your use case (for example, contentType="text/json" for JSON files). Configure the page without standard stylesheets, sidebar, or header tags to produce clean output. Each integration file (for example, assetlinks.json and apple-app-site-association) requires its own separate Visualforce page.
If your use case is for Mobile Publisher, Experience Cloud, or similar Lightning solutions, ensure the checkbox "Available for Lightning Experience, Experience Builder Sites and the mobile app" is enabled on the Visualforce page.
Create an Apex class that implements the Site.UrlRewriter interface. The URL rewriter intercepts incoming requests and redirects them to the appropriate Visualforce page based on the URL pattern.
The class should implement the mapRequestUrl method to check whether the incoming URL matches your desired integration file path (for example, whether the URL ends with 'assetlinks.json'). If the URL matches, the method returns a new PageReference to the corresponding Visualforce page. The generateUrlFor method should return null because reverse URL mapping is not needed for this use case.
If you are integrating your third-party service across multiple Salesforce Sites, you may need to create multiple URL Rewriter classes — one for each site.
After assigning the URL rewriter, test your implementation by navigating directly to the configured path in your browser (for example, ). The browser should display the JSON content served by your Visualforce page.
000396664

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.