Routing within a SPA using redirects

Hello everyone,

I have set up routing within a website I’m working on so it is possible to navigate from:

to a new page

However, when I refresh the page or try to directly navigate to SEASLUG.SE it sends me to

How would I remedy this? Any support or guidance greatly appreciated !

Hello @turnleft , thanks for posting.

What type of routing library are you using and if possible can you share a repository of the website?


Hey @clarnx, unfortunately it’s a private repo however I am using react-router-dom. Looking forward to hearing back.


Hi @turnleft

This domain level redirect (www → non-www or vice versa) is handled automatically by Netlify. If you wish to use the apex and not the www subdomain as the primary domain, set it to the primary


Hello @turnleft , thanks for the extra feedback.
Since you are using React Router DOM, make sure that all paths respond with your the index.html page that your React app is used in.
Therefore create a file named “_redirects” in the public folder and then add the content below.

/* /index.html 200

Let me know if it works. Thanks.

Hey @clarnx & @coelmay,

Appreciate the support although perhaps I had miscommunicated my question. Nevertheless I resolved it yesterday (as can be demonstrated: SEASLUG.SE)
Nevertheless, appreciate the support !

1 Like

Great you resolved the issue @turnleft.

So I’m confused, what was the actual issue?

I am not sure what the demonstration was either. still redirects to, which is what I understood was the issue.

Hi @coelmay. Based on what I observed as at yesterday if you visited the site and clicked on the Venues Link in the menu it sends you to with the Venues List content on the page.

However if you refreshed or directly typed it in the browser url bar and hit enter the content of the page does not show the Venues List but rather the content of the Home page.

Looks like @turnleft fixed it. Now when you visit the it shows the Venues List.

@turnleft If you don’t mind sharing what was the cause of the issue?
Sharing what caused the problem might help others in the future who might visit this post when they experience a similar issue.


1 Like