question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

index.html as default file in subfolders?

See original GitHub issue

Currently, when I open something like localhost:8080/path, I get the fallback /index.html file instead of an existing file /path/index.html. Most servers, including GitHub pages, are by default configured “smartly” and return the index.html file (if it exists) when a folder is requested. Would be nice for this to be configurable, or maybe even default?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sw-yxcommented, Apr 2, 2020

also swimming by to say this was rather unintuitive for me. using servor through svelvet, and it wasn’t obvious that this was ONLY for SPAs. i kept refreshing thinking something was wrong. expected there to be a config to serve any existing html files. so i guess count this as a “+1” haha.

usecase - making a svelte site generator, need this for local dev mode

if you’ll take a PR and/or give some specs i can try to PR - but also totally cool if you just want to keep it focused on the SPA usecase. my plan would be to add a flag, say --indexes like you suggest, and then modify the isRouteRequest logic and serve the correct file. Ofc if its easier for you to do it then go for it, i dont feel super confident about this stuff 😃


edit: hang on… are we just slowly replicating sirv? help me get my head straight here i’m confused how they differ now apart from the zero dep/SPA only thing here

1reaction
lazarljubenoviccommented, Apr 25, 2019

Ah, right. This is for SPA. I used servor for single-page apps and just continued to use it for regular plain old websites, didn’t even think twice. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to open an index page into a subdirectory without adding ...
try this: fvimagination.com/testhtml the testhtml subdirectory has an index.html page inside, but the browser doesn't find that page. May it be ...
Read more >
Serving index.html from a subdirectory - apache 2.2
I tried using an index. php with a redirect in document root, as well as a . htaccess redirect, but both of them...
Read more >
How can the index.html file be served from a sub directory of ...
html file be served from a sub directory of the DocumentRoot without using system level links? For example: Let the document root of...
Read more >
Have Subdirectory of site show the index.html file when going ...
The client now wants to have any of the subfolders of the root site show the index. html to any subdirectory sites. Example....
Read more >
How to Add empty index.html from each folder and subfolder?
When surfing to any subfolder in my web site the browser displays the list of files in that directory. I would like to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found