How to auto-load index.html in sub-directories with Apache 2

Viewed 21133

I'm having problem auto-loading index.html in sub-directories with Apache 2. Auto-loading of index.html works fine for root directory.

You see, to make things generic, my web app is written such that each module resides in its own sub-directory. Each folder has 3 files - index.html for the front end (contains html + javascript), index.php for the backend (contains php code to access database) and index.css for styling.

Hence, to access the various modules in the web app:

[Overview module] - http://xyz.com/overview?id=1234567890

[Details module] - http://xyz.com/details?id=1234567890

Without the auto-load mechanism for sub-directories, the above would not be possible.

I would appreciate any help. Thanks much!

2 Answers

You can use the following line in your .htaccess file:

DirectoryIndex index.html

Works even if you don't control the server configuration (if you use Gitlab Pages for example).

Related