gpt4 book ai didi

Reloading a specific page in hostinger hosting gives 404 error, its a react website(在hostinger主机中重新加载特定页面会出现404错误,这是一个反应网站)

转载 作者:bug小助手 更新时间:2023-10-22 16:38:58 29 4
gpt4 key购买 nike



i have created a react website but problem is when i go to specific page like contact or about page and refresh the browser or directly open a page like www.mywebsitedomain.com/about it gives 404 error however on when i run using npm run start in development this thing doesnt happens when i deployed on netlify i used netlify.toml, website runs perfectly first freelance website i bought hosting and domain on hostinger website crashes

我已经创建了一个react网站,但问题是当我转到特定的页面(如contact或about页面)并刷新浏览器或直接打开www.mywebsitedomain.com/about页面时,会出现404错误。然而,当我在开发中使用npm run start运行时,当我部署在netlify上时,我使用netlify.toml,网站运行完美我在hostinger网站上购买的第一个自由职业网站托管和域名崩溃


i tried searching but no help

我试着找,但没有帮助


更多回答

Please provide enough code so others can better understand or reproduce the problem.

请提供足够的代码,以便其他人能够更好地理解或重现问题。

优秀答案推荐

You have to do this:

你必须这样做:


Steps:

步骤:



  1. In your public folder create a file called .htaccess

  2. Copy and paste the following code in that file:


    <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>


  1. Build your app using npm run build in terminal.

  2. Upload the files inside dist folder into public_html folder of hostinger.

  3. Enjoy your routing.


更多回答

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com