direct Access to pages resulting in 404 error

i'm encountering a situation where accessing pages directly via their URLs leads to a 404 error, but navigating to them after loading the main website doesn't produce any errors. could someone help me troubleshoot this issue? it seems to be related to routing. thank you!
11 Replies
Jasi 🖤🌈
Jasi 🖤🌈3mo ago
@ghost_soul0 Where are you hosting your website? You need to configure your proxy to always direct to / as we're working with an SPA
ghost_soul0
ghost_soul03mo ago
i am hosting it on vercel
Jasi 🖤🌈
Jasi 🖤🌈3mo ago
with the default vite preset?
ghost_soul0
ghost_soul03mo ago
idk sorry i just installed vercel client could you please tell me how to configure the proxy ? i am not familiar with configuring proxies, this is my first project i am working on yes yes
Jasi 🖤🌈
Jasi 🖤🌈3mo ago
hm the default vite preset should configure it properly already ohh nevermind here:
Jasi 🖤🌈
Jasi 🖤🌈3mo ago
create a vercel.json file in the project root and insert that
ghost_soul0
ghost_soul03mo ago
yup now i am able to access any page with url also without first going to the main route thank you so much what was the reason i wasnt able to access pages with url ? can you please explain it to me
Jasi 🖤🌈
Jasi 🖤🌈3mo ago
you're running an SPA, which only servers one single page (the root page, index.html). And solid-router resolves the url and renders the matching component, but this all happens on the same page. So even if a user navigates to /otherpage, you need to serve the index.html and solid-router than matches the /otherpage and renders the matching component.
ghost_soul0
ghost_soul03mo ago
thank you so much for explaining , i almost understood why this issue but little bit confused this was new to know , will learn more as i work more with these. thank you for helping me resolve this issue .
Jasi 🖤🌈
Jasi 🖤🌈3mo ago
you're welcome! Yeah, watch some youtube videos regarding SPA's. Might clear up some open questions :)
Want results from more Discord servers?
Add your server
More Posts
Does the createMemo() in the "Solid in 100 secs" vid make sense?Hi - I just stumbled upon Solid, and the two introductory vids really made me curious, coming from RHow do i make a dropdown menu?This is what I/ChatGpt currently have come up with, but the handleClickOutside function doesnt work.getRequestEvent not return the correct type in monorepoI need a package that shared between apps. I add `solid-js` and `@solidjs/start` as `peerDependencieWhat's the correct way to make store persistent?I am making some sort of widget manager and i have no control over how many options/ styles will thWhy can't I change the path alias "~/*" to "@/*" in the tsconfig.json?Using `@/*` would be easier on my keyboard. After changing it the imports work correctly in VS Code Does SolidStart support private folders in the routes directory?Like described here: https://nextjs.org/docs/app/building-your-application/routing/colocation#projecPreloading Data with 'use server'I'm following the limited documentation, and I want to preload data from the server for a route: ```Tailwind CSS Styles Not Applied After Adding SolidJS Routes, Why ?I encountered an issue after integrating SolidJS routes into my project. I created components for diAre store reactive?```ts const [params, setParams] = createStore<Params>( props.value ?? { data: [ Render a new router and redirect in action of opened component doesn't redirect in the opened windowExample codes ``` export function winOpen(provider: string) { if (window) { const win =