Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default file other than index.html

Tags:

jekyll

Is there a way to have a file other thing index.html or index.md served as a folder's default file? Specifically, I'm looking to keep my .json file extention, but have it reference-able as /api-docs/myapi/ instead of /api-docs/myapi/myapi.json.

like image 810
shawnjohnson Avatar asked Dec 16 '25 18:12

shawnjohnson


1 Answers

This configuration is mostly in your web server. You can set the files for the server to look for to index.json (as well as index.html and index.htm which are common on most servers). For example, this can be configured on nginx by adding this to your server block:

index index.json index.html index.htm;

If nginx gets a request for /some/folder, it will try to serve /some/folder/index.json, /some/folder/index.html, /some/folder/index.htm then your 404 page with this configuration.

like image 132
SAMdroid Avatar answered Dec 19 '25 23:12

SAMdroid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!