R
Railway15mo ago
JustJake

[PHP] Route all requests to index.php

Josh Pigford (@Shpigford)
Obscure-ish @Railway PHP question. Is there some way I can route all requests to index.php (which is where I handle routing for the app)?
From Josh Pigford (@Shpigford)
Twitter
10 Replies
Percy
Percy15mo ago
Project ID: N/A
JustJake
JustJake15mo ago
I don't quite understand their question, but I've also not written PHP in literal decades @silent @aleks who IIRC wrote the provider? Boomer moment with the at silent sorry Aleks ;_;
Brody
Brody15mo ago
their code handles the routing, they want all traffic to be directed to index.php, similar to a spa react app with react router
JustJake
JustJake15mo ago
Yea. Seems to me a PHP config thing. Unsure if they're using Laravel or what not But there's gotta be some framework or language specific thing that says "Let me handle the routing"
Brody
Brody15mo ago
they would need to modify the nginx.template.conf file to send all requests to index.php ive helped other people do this before, ill see if i can find it
Brody
Brody15mo ago
i dont know if this whole config will work for their specific use case, but line 34-36 does what they need
JustJake
JustJake15mo ago
Josh Pigford (@Shpigford)
@JustJake @Railway Thanks Jake! Actually just got it working. Setting NIXPACKS_PHP_FALLBACK_PATH to index.php did the trick, per the Nixpacks docs: https://t.co/Vxe7zW6j61
Twitter
JustJake
JustJake15mo ago
Seems we've got a nixpacks config for it 😄 Thanks a mill tho Brody ❤️
Brody
Brody15mo ago
ah if aleks was here he would have known that lol
root
root15mo ago
I just implemented that a couple of weeks ago, because of a similar help request
Want results from more Discord servers?
Add your server