About 2 to 3 years ago the community came to the conclusion that repl does not provide htaccess.
How is that in 2023?
Is that expected to work now?
For the specific case 404 - is there a solution in place?
Could an extension respond to 404?
Or did the PHP community go elsewhere to play around with php?
Hey @matjung, welcome to the forums!
Nope, still no htaccess. There is a feature request for it, though.
I don’t know, use a different language for backend?
Given that only 15 guys voted for the feature request - it may never get implemented.
I will work with an ugly workaround:
In file .replit I updated the run command into
run = “php -S 0.0.0.0:8000 index.php”
In addition, one needs to replace index.php with some routing rules as outlined in the php documentation.
I made a fairly simple Node.js template for changing the 404 page here, though I’m not sure if that’s what you want in this case.
If I ever have to use .htaccess, I link my Repl to a Git Repository and share the link to my Repl via the GitHub Pages link. There is a strategy that replaces .htaccess file’s method of removing the “.html” from URLs. The way to do this is to create a folder named whatever you want the sub URL to be named and put a index.html in this. It is a little inefficient, though. There is no current workaround for 404 pages though, at least that I know of.
That’s actually a lot for this forum.
htaccess is Apache related stuff, whereas replit php is based on the php built-in web server.
We are asking replit to replace or extend php with Apache php - an additional layer of work and maintenance.
replit seems to be a playground designed for Python and Node, not Apache.
On the other side, replit is writing about nix which provides a package apache-httpd
I reckon with some Try and Error, someone would manage to get Apache PHP running on replit.