You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Expo Universal Links部署问题:Hostinger托管下验证失败

Hostinger托管下React Native Expo Universal Links验证失败解决方案

具体排查与修复步骤:

  • 检查apple-app-site-association文件

    • 必须放在网站根目录,文件名无.json后缀,直接命名为apple-app-site-association。
    • 内容严格遵循苹果规范,示例结构:
      {
        "applinks": {
          "apps": [],
          "details": [
            {
              "appID": "你的开发者TeamID.应用BundleID",
              "paths": ["*", "/指定路径/*"]
            }
          ]
        }
      }
      
    • 用JSON校验工具确认内容无语法错误。
  • 更新.htaccess配置
    替换原配置为更适配Hostinger环境的规则:

    <FilesMatch "^apple-app-site-association$">
      ForceType application/json
      Header set Content-Disposition "inline"
    </FilesMatch>
    

    新增的Content-Disposition头能避免浏览器触发文件下载,确保苹果爬虫正常读取内容。

  • 验证HTTPS与文件权限

    • 确保网站已开启HTTPS(Universal Links强制要求)。
    • 设置文件权限为644,所在文件夹权限为755,防止因权限不足导致无法访问。
  • 测试文件可访问性

    • 在浏览器直接访问https://你的域名/apple-app-site-association,确认能直接显示JSON内容,而非404或下载弹窗。
    • 用curl命令检查响应头:
      curl -I https://你的域名/apple-app-site-association
      
      需确保返回的Content-Type为application/json,状态码为200。
  • 清理Hostinger缓存
    Hostinger默认开启缓存,修改配置后需登录后台清理全站缓存。测试阶段可临时禁用该文件的缓存,在.htaccess中添加:

    <Files "^apple-app-site-association$">
      Header set Cache-Control "no-cache, no-store, must-revalidate"
      Header set Pragma "no-cache"
      Header set Expires 0
    </Files>
    
  • 重新验证
    完成所有调整后,再次用验证工具检测是否符合要求。

内容的提问来源于stack exchange,提问作者A. Shokr

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 05:42:15