For a simple html-css webpage I could access a folder of music files under the public_html and display those music files in a browser. But now I have used a React App with create-react-app. How do I access a folder I have put on a server under public_html like so public_html/songs/
? Current behavior when I try to hit an endpoint like
mysite.com/songs
in a browser, it just displays React App home page regardless of the URL address, which in essence is mysite.com
Asked
Active
Viewed 146 times
0

Klem Lloyd Mwenya
- 388
- 1
- 6
- 17
-
Does this answer your question? [Is it possible to serve Static files with create-react-app from public folder?](https://stackoverflow.com/questions/53014651/is-it-possible-to-serve-static-files-with-create-react-app-from-public-folder) – Andy Ray Dec 28 '22 at 21:51
-
@AndyRay op is probably asking how to route react application using some kind of server that isn't mentioned. I guess that the server is apache – Konrad Dec 28 '22 at 21:56
-
Does this answer your question? [How to setup apache server for React route?](https://stackoverflow.com/questions/44038456/how-to-setup-apache-server-for-react-route) – Konrad Dec 28 '22 at 21:57
-
No there is a music folder uploaded to my server in the following directory `www.mysite.com/songs/`. In a simple HTML website, I could have song files displayed in the song folder in the form of underlined links of song names.mp3 displayed in the browser but the react app that I currently have just displays a home page for react app which won't allow me hitting the songs folder to display its contents in the browser – Klem Lloyd Mwenya Dec 28 '22 at 22:10
-
@KlemLloydMwenya, there's likely a server setting that prevents seeing the folder structure of your hosted website, so you can't just point the user to a directory and expect them to see the contents of it. You either need to change that setting (which is likely an admin setting and not changeable on purchased shared hosting) or set up a page to get a list of the contents in the folder and then dynamically create a page with links to each of those items. – computercarguy Dec 28 '22 at 22:15