简体   繁体   中英

Php query apache values for Options Indexes

Is there a way in php to query what the value of listing indexes is. Assuming i have a .htaccess file with the following set.

 Options -Indexes

I have a 404 script that checks the local folder and shows you relevant choices, however if that folder has those directory listing off, i dont want to show any relevant files.

Is this even possible to get in php?
I would really prefer not to start parsing .htaccess files.

I would really prefer not to start parsing .htaccess files

Actually, if you wanted to determine the configuration from the configuration files you would need to parse the the httpd.ini (including all the structural elements such as vhosts, directories, aliases....) as well as the .htaccess files.

In theory you could

  • check there's no 'index.*' file in the directory
  • map those directories to localhost URLs,
  • fetch the content via HTTP
  • see if the content looks as if it was generated by mod_index

and then show them. While a lot less effort than parsing the config, it still sounds like a lot of work to me.

The least effort solution is to build and maintain a sitemap.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM