我在本地主机上使用ReactJS创建了一个简单的登录页面,它在http:// localhost:3000上运行良好。然后我想捕获一些营销参数,我这样做是用的,它也可以正常工作,但是在部署它时,使用这些参数时会出现空白页面。
App.js
<Switch>
<Route path="/" children={<Normal />} />
</Switch>
<Switch>
<Route path="/:cn/:cid" children={<Markdata />} />
</Switch>
.htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
package.json
....
"name": "muslimsgate",
"homepage": ".",
"version": "0.1.0",
"private": true,
....
.env文件
/* /index.html 200