Home > AI > Frontend > ReactJS >

React Router nested level problems

Problem 1: cannot load relative static resources

<head>
<base href="/">
</head>

Problem 2: cannot refresh page

If you got 404 error, you need to set your .htaccess

RewriteEngine On  
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteRule ^ /index.html [L]


Options All -Indexes

If you got a blank page, then is the React’s culprit

change your index.html

<head>
<base href="/">
</head>

Problem 3: cannot load assets resources

process.env.PUBLIC_URL + "/assets/"

Leave a Reply