0

I have a problem. I do not what to be able users to list in my web so I use this: Options -Indexes For whatever reason the external JavaScript is not loading. But when I erase this line in .htaccess it works pretty good.

Does Option -Indexes means that also JavaScript cannot list in directory? If, how to enable it for JavaScript and disable for users?

2
  • 1
    That option should have no bearing on JS. Can you post screenshots from browser develop tools showing exactly which files aren't loading? Apr 20, 2020 at 14:16
  • I am calling external JavaScipt file. But the Javascript file (.js) os not loading. As suggested from @Steve I place an index file in the folder so now it is loading properly (the JavaScript file)
    – user110400
    Apr 20, 2020 at 17:12

1 Answer 1

0

Options -Indexes should only prevent listing of directories that don't have an index file. I haven't heard of the Javascript behaviour before.

There is a way around it. Don't include the Options -Indexes in your .htaccess, instead include an empty index file e.g. default.html or index.php (or whatever is set up for your server) in each directory.

1
  • Thanks! For my testing example it works! But I have AngularJS that I want to be not directory listed and it have bazillions of folders. So I cannot place blank page in each. So how to prevent it with working JavaScript? Could I make PHP file that will load all .js files and then send them to HTML?
    – user110400
    Apr 20, 2020 at 6:53