---
schema_version: "1"
id: c22fac05c4c079d4c5abeca90d1e697d9019eaba307af27b6c9327f6e54af6eb
title: Override iOS Universal Links to Your Mobile Publisher App
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/branded_apps_override_links_ios.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.branded_apps_override_links_ios.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 8b54bba1010b1c7d87565d8c87706292222d4e5e81cf3b7f1bb9809c5fbea3d5
description: Mobile Publisher for Experience Cloud apps support universal links on iOS. By default, when a user taps a universal link to your Mobile Publisher app, the link opens to the page inside your app. To override the default behavior and set certain links to open outside of your app, use an Apex class and a Visualforce page. For example, if you want the link to your app’s registration page to open in a web browser.
products:
  - Experiences
  - Mobile App
  - Cross Cloud
release: "264"
---
# Override iOS Universal Links to Your Mobile Publisher App

Mobile Publisher for Experience Cloud apps support universal links on iOS. By default, when a user taps a universal link to your Mobile Publisher app, the link opens to the page inside your app. To override the default behavior and set certain links to open outside of your app, use an Apex class and a Visualforce page. For example, if you want the link to your app’s registration page to open in a web browser.

Complete these steps to override the default behavior of universal links to your iOS app.

1. Create an Apex class named ReDirectToCustomUniversalAndAppLinks.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-branded_apps_exp_cloud-264-0-0-production-enus/cf85363c-215e-4784-bb6a-c5c83c4e7140/images/icon_note.png)
    
    Note You must use the same Apex class for both the Android and iOS versions of your app. If you already created the ReDirectToCustomUniversalAndAppLinks Apex class for the Android version of your app, continue to step 2.
    
    1. From Setup, in the Quick Find box, enter Apex Classes, and then select **Apex Classes**.
    2. Click **Developer Console**.
    3. In the Developer Console, click **File**, select **New**, and then select **Apex Class**.
    4. Name the class ReDirectToCustomUniversalAndAppLinks.
    5. Add this code to the Apex class.
        
        ```java
        global class ReDirectToCustomUniversalAndAppLinks implements Site.UrlRewriter {
          global PageReference mapRequestUrl(PageReference srcUrl) {
            String url = srcUrl.getUrl();
            // Code for Android
            if (url!=null && url.endsWith('assetlinks.json')) {
              url = '/CustomAssetLink';
              return new PageReference(url);
            }
            // Code for iOS
            if (url!=null && url.endsWith('apple-app-site-association')) {
              url = '/CustomAASA';
              return new PageReference(url);
            }
          return null;
        }
        global PageReference[] generateUrlFor(PageReference[] srcUrls) {
          return null;
        }
        }
        ```
2. [Create a Visualforce page](https://help.salesforce.com/s/articleView?id=platform.pages_creating.htm&type=5&language=en_US) named CustomAASA.
3. Edit this sample markup to define the pages in your Experience Cloud site to open outside of your app.
    
    1. In the appIDs field’s placeholder value of YOUR\_TEAM\_ID.YOUR\_STORE\_IDENTIFIER, replace YOUR\_TEAM\_ID with your [Team ID on Apple](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/) and replace YOUR\_STORE\_IDENTIFIER with your app’s Mobile Publisher store identifier. For example: 12A34BCD5E.com.mysalesforce.mycommunity.C00AB0000000CDefGHI.A0BCD00000001ABcDEF
    2. In the paths field, list the pages that you want to open outside of the app. For each app page that you want to open outside of the app, enter the prefix NOT and then the relative path of the page. For example: "NOT /experienceCloudSitePathPrefix/\*login\*"
    3. As the last entry in the paths field, enter the relative path to your app’s Experience Cloud site. For example: "/experienceCloudSitePathPrefix/\*"
        
        ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-branded_apps_exp_cloud-264-0-0-production-enus/cf85363c-215e-4784-bb6a-c5c83c4e7140/images/icon_note.png)
        
        Note In the sample markup, make sure to replace all instances of experienceCloudSitePathPrefix with your app’s Experience Cloud site path prefix.
    
    CustomAASA.vfp
    
    ```
    <apex:page standardStylesheets="false"
               sidebar="false"
               showHeader="false"
               applyHtmlTag="false"
               applyBodyTag="false"
               contentType="text/json">
    {
       "applinks":{
          "apps":[  
          ],
          "details":[
             {
                "appIDs":[
        		   "YOUR_TEAM_ID.YOUR_STORE_IDENTIFIER"
                ],
                "paths":[
                   "NOT /experienceCloudSitePathPrefix/*login*",
                   "NOT /experienceCloudSitePathPrefix/*Login*",
                   "NOT /experienceCloudSitePathPrefix/s/*login*/*",
                   "NOT /experienceCloudSitePathPrefix/setup/secur/*",
                   "NOT /experienceCloudSitePathPrefix/secur*/*",
                   "NOT /experienceCloudSitePathPrefix/servlet/*",
                   "NOT /experienceCloudSitePathPrefix/services/*",
                   "NOT /experienceCloudSitePathPrefix/apex/*",
                   "NOT /experienceCloudSitePathPrefix/one/one.app",
                   "NOT /experienceCloudSitePathPrefix/sfc/*",
                   "NOT /experienceCloudSitePathPrefix/profilephoto/*",
                   "NOT /experienceCloudSitePathPrefix/img/*",
                   "NOT /experienceCloudSitePathPrefix/file-asset/*",
                   "NOT /experienceCloudSitePathPrefix/saml/*",
                   "/experienceCloudSitePathPrefix/*"
                ]
             }
          ]
    }
    </apex:page>
    ```
4. Enter the edited markup into the **Visualforce Markup** field of the CustomAASA Visualforce page, and save.
5. Make the CustomAASA Visualforce page available to your Experience Cloud site and mobile app.
    
    1. From Setup, in the Quick Find box, enter Visualforce Pages, and then select **Visualforce Pages**.
    2. Click the CustomAASA label for the Visualforce page that you created.
    3. In the Page Detail settings, select **Available for Lightning Experience, Experience Builder sites, and the mobile app**.
    
    ![The Visualforce page settings for CustomAASA](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-branded_apps_exp_cloud-264-0-0-production-enus/cf85363c-215e-4784-bb6a-c5c83c4e7140/branded_apps_exp_cloud/images/branded_apps_link_override_customaasa.png)
6. Enable the CustomAASA Visualforce page for your Experience Cloud site.
    1. From Setup, in the Quick Find box, enter Sites, and then select **Sites**.
        
        ![Entering Sites in the Setup Quick Find box and the link to Sites](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-branded_apps_exp_cloud-264-0-0-production-enus/cf85363c-215e-4784-bb6a-c5c83c4e7140/branded_apps_exp_cloud/images/branded_apps_link_override_sites.png)
    2. Click the site label for your Mobile Publisher app’s Experience Cloud site.
    3. Click **Public Access Settings**.
    4. Click **Enabled Visualforce Page Access**.
        
        ![The link to Enabled Visualforce Page Access from the top of a site's profile page](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-branded_apps_exp_cloud-264-0-0-production-enus/cf85363c-215e-4784-bb6a-c5c83c4e7140/branded_apps_exp_cloud/images/branded_apps_link_override_visualforce.png)
    5. Click **Edit**, and then add the CustomAASA page to the list of enabled Visualforce pages.
    6. Save your changes.
7. Set the ReDirectToCustomUniversalAndAppLinks Apex class as the URL rewriter for your Experience Cloud site.
    1. In the Site Detail section of your Experience Cloud site, click **Edit**.
        
        ![The Edit button at the top of a site's detail page](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-branded_apps_exp_cloud-264-0-0-production-enus/cf85363c-215e-4784-bb6a-c5c83c4e7140/branded_apps_exp_cloud/images/branded_apps_link_override_site_details.png)
    2. In the URL Rewriter Class field, search for and select the ReDirectToCustomUniversalAndAppLinks Apex class.
    3. Save your changes.