Can't directly view the /login and /register pages

I can run my application locally and access directly with

http://localhost:8081/login
http://localhost:8081/register

But after deployed to netlify, if I directly clilck below urls, they don’t work, got “Page Not Found”

https://relaxed-meninsky-fc3fd1.netlify.app/login
https://relaxed-meninsky-fc3fd1.netlify.app/register

If I click the button of “login” or "register on website, it still work fine.

https://relaxed-meninsky-fc3fd1.netlify.app

Related github repo:

hi there, are you using Netlify CMS for your app? It doesn’t seem so, but you posted in the Netlify CMS category?

@perry The repo doesn’t have Netlify CMS included, you can remove the tag.

@ozbillwang The reason your pages do not load when accessed directly is because you’re hosting a SPA, therefore you’ll have to add a redirect rule: https://docs.netlify.com/routing/redirects/rewrites-proxies/#history-pushstate-and-single-page-apps

2 Likes