Reputation: 413
I created a ReactJs application and what to be accessible only in domain.com/app.
I added this to index.js
<BrowserRouter basename='/app/'>
<App />
</BrowserRouter>
And now when I navigate between pages it works as it should (it adds /app/
properly), ex. domain.com/app/about
.
But the application is still being accessible without /app
, ex. when I type domain.com/about
still shows the about page.
While I want it bo be accessible only with /app/
, and not without it.
Upvotes: 3
Views: 18773
Reputation: 79
it seems that you have accidently added a trailing slash, which is not required.
see https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string for more details.
Upvotes: 7