我按照以下步骤在 cPanel 上部署 nextjs。
转到 package.json 并添加以下行:"homepage": "http://afsanefadaei.ir"
run next build
具有.next
文件夹作为我的构建文件夹
go to cpanel >> file manager >> public_html
文件夹并上传内容.next
文件夹到这个目录
-
添加或编辑此文件:.htaccess
to:
但当我访问该网站时,我会遇到以下问题:
你知道这有什么问题吗?
我上传了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>
它对我有用????
问题:当我在不同的路线上刷新页面时,比方说/about
,它带来了index.js
页面内容但 URL 未更改为/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)