Reputation: 87
I served a react page under 127.0.0.1/react/
sub directary with my gateway. It can be viewed by explorer with 127.0.0.1/react/
. But if I input 127.0.0.1/react
it returns my vue page served under 127.0.0.1
which failed to match any routes.
There is another example https://www.curseforge.com/minecraft/mc-mods.
https://www.curseforge.com/minecraft/mc-mods
is okay while https://www.curseforge.com/minecraft/mc-mods/
returns 404 not found
. What's the difference?
Ordinary users might treat them as same url, they would expect both of them can access the page. So how should I make them both accessable?
Upvotes: 1
Views: 118
Reputation: 163232
The server can return whatever it wants for any path, and doesn't need to follow any particular standard conventions. However, most servers do follow some norms:
/react/
usually ends up fetching the index file (usually index.html
unless configured otherwise) from the react
folder under the web root. This is returned to the client transparent... the client isn't redirected.
/react
This is a request for a file named react
under the main root. However, in the absence of such file, and the presence of a folder, it's common to redirect the client to /react/
.
How you do this depends entirely on your server configuration. You didn't tell us the server, so we can't point you in the right direction.
Upvotes: 1