How can I return an index.json file in a folder when the folder is navigated to using .htaccess?
I have the following directory and file structure:
/api/.htaccess
/api/index.json
/api/page-1/index.json
/api/page-1/page-a/index.json
/api/page-1/page-b/index.json
/api/page-2/index.json
/api/page-2/page-a/index.json
/api/page-2/page-b/index.json
/api/page-foo/index.json
and I would like them to appear when you navigate to the following URLs:
/api/
/api/page-1/
/api/page-1/page-a/
/api/page-1/page-b/
/api/page-2/
/api/page-2/page-a/
/api/page-2/page-b/
/api/page-foo/
How can I update the api/.htaccess file to allow this? So far all I have working is this bit:
RewriteEngine On
RewriteRule ^/?$ index.json [L]
AddType application/json json
Which is successfully showing /api/index.json at the /api/ endpoint, but it doesn't point /api/page-1/ to /api/page-1/index.json