【问题标题】:Issue with htaccess when deploying next js app to FTP (filezilla)将下一个 js 应用程序部署到 FTP (filezilla) 时出现 htaccess 问题
【发布时间】:2021-10-30 17:44:12
【问题描述】:

编辑:
主机有子域,所以我添加了basePath: "/thesubdomain", 并且现在正常工作

我尝试将out 目录从下一个 js 应用程序上传到之后出现的 filezilla next build && next export。 但是现在样式不加载,nextjs 基本路由器也不工作。

基本上将原始 html 加载到浏览器。

我的.htaccess 是什么样子的(也许这就是问题所在,不知道):

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [QSA,L

我在 docs/google 中没有找到任何内容。

提前致谢!

【问题讨论】:

  • @juliomalves 我已经完成了。谢谢:)

标签: javascript .htaccess ftp next.js filezilla


【解决方案1】:

如果 hostsubdomain(如我的情况),请尝试将 basePath: "/thesubdomain" 添加到您的 next.config.js。 这应该可以解决问题。

【讨论】:

    【解决方案2】:

    我建议您在本地运行 next build && next export,然后将 .next 或 build 文件夹部署到 FTP

    【讨论】:

      猜你喜欢
      • 2023-02-24
      • 2020-10-22
      • 2017-01-26
      • 2014-11-25
      • 2020-10-27
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 2011-04-19
      相关资源
      最近更新 更多