Afs*_*fda 1 deployment .htaccess cpanel reactjs next.js
我按照这些步骤在 cPanel 上部署了我的 nextjs。
转到 package.json 并添加以下行: "homepage": "http://afsanefadaei.ir"
运行next build以将.next文件夹作为我的构建文件夹
转到cpanel >> file manager >> public_html文件夹并将文件夹的内容上传.next到此目录
添加或编辑此文件:.htaccess到:
但是当我访问该网站时,我遇到了以下情况:
你知道这有什么问题吗?
.next没有index.html 文件。next export而不是。next build但最重要的是第一件事,确保你index.html的文件夹中有.next。
小智 6
我上传out(它被生成npm run build && npm run export)文件夹到public_html并创建了.htaccess文件,如
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-L
RewriteRule . /index.html [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
问题:当我在一些不同的路线上刷新页面时,比方说
/about,它带来了index.js页面内容,但 URL 不会更改为/
| 归档时间: |
|
| 查看次数: |
7614 次 |
| 最近记录: |