Please share your site name, @Ebony4991.
I build my portfolio on react it works good on local host but on netlify only the main page works, when I try to redirect to âAboutâ page it says link broken or doesnât exist. what can I do? this is the URL to my website
Hi @navisasabeti10,
Thanks for reaching out!
The issue you described, where only the main page works and navigating to the âAboutâ page results in a broken link or a page that doesnât exist, is likely related to how client-side routing is handled in your React application.
When you use client-side routing in a React application, the routing is typically handled by JavaScript on the client side. However, when a user navigates directly to a specific URL, the server needs to be configured to serve the same index.html file for all routes.
To set up a redirect for a single-page application (SPA) on Netlify, you can use a rewrite rule to serve the index.html
file regardless of the URL the browser requests. You can configure this rule using either a _redirects
file or a netlify.toml
file.
In the _redirects
file, add the following line:
/* /index.html 200
Alternatively, you can use the netlify.toml
file to configure the redirect:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Let us know if you have any questions.
I have same issue. I can only see my Home page. I canât see other pages.
Here is my url.
Your website appears to work @Chucks. Please describe the issue.
https://andrewss-portfolio.netlify.app/contact
this is the link to my website portfolio. iâm getting this error from my contactform
Hi @drew58,
Thanks for reaching out and welcome to the Netlify Support Forums!
Could you try adding the either of the following:
To set up a redirect for a single-page application (SPA) on Netlify, you can use a rewrite rule to serve the index.html
file regardless of the URL the browser requests. You can configure this rule using either a _redirects
file or a netlify.toml
file.
In the _redirects
file, add the following line:
/* /index.html 200
Alternatively, you can use the netlify.toml
file to configure the redirect:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Let us know if you continue to have issues after adding either the _redirect file or the netlify.toml. Thanks!
I still experience the same issue. did all the stuff above to try and fix the issue but still.
Hi @d41,
Thanks for reaching out!
I believe the issue may be with your build settings. Looks like you have a monorepo, and will want to set the Base directory to vite-project
and add a build command such as npm run build
.
Additionally, youâll want to correct this line your package.json
.
Hi Melvin,
Thanks for the response. So for my understanding, I have to change the highlighted line in my package.json to âpackage.jsonâ?
And now with the pointer you gave me is the build failing. See screenshot attached. Im new to this, so I have no idea how to figure this out.
Okay, after deleting the package-lock and node module file and running npm i again it finally worked. But now my site is blanco???
Hi, @d41. It looks like the site has been deleted.
im on mobile that means i cant use the website to install the app that uses netlify
Can you elaborate on what exactly you are trying to do @idkwhatnamehere
Not sure what you mean here. Can you clarify? Are you trying to access our platform from your mobile?