首页 > 解决方案 > 反应js,当打开页面时在新标签中显示404以外的主页

问题描述

我加载 url http://reactnext.mohan21.ir并显示我的项目,但是当我在新选项卡中打开http://reactnext.mohan21.ir/about时,它显示 404 错误。我该如何解决这个错误?

标签: reactjs

解决方案


我使用 htaccess 并在没有 404 的情况下运行

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]

推荐阅读