简体   繁体   English

选项索引的PHP查询Apache值

[英]Php query apache values for Options Indexes

Is there a way in php to query what the value of listing indexes is. 在php中有没有一种方法可以查询列表索引的值。 Assuming i have a .htaccess file with the following set. 假设我有一个带有以下设置的.htaccess文件。

 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. 我有一个404脚本,用于检查本地文件夹并显示相关选项,但是,如果该文件夹列出了这些目录,则我不想显示任何相关文件。

Is this even possible to get in php? 这甚至有可能进入PHP?
I would really prefer not to start parsing .htaccess files. 我真的希望不要开始解析.htaccess文件。

I would really prefer not to start parsing .htaccess files 我真的很想不要开始解析.htaccess文件

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. 实际上,如果要从配置文件确定配置,则需要解析httpd.ini(包括所有结构元素,例如vhost,目录,别名...)以及.htaccess文件。

In theory you could 理论上你可以

  • check there's no 'index.*' file in the directory 检查目录中是否没有“ index。*”文件
  • map those directories to localhost URLs, 将这些目录映射到localhost URL,
  • fetch the content via HTTP 通过HTTP获取内容
  • see if the content looks as if it was generated by mod_index 查看内容是否看起来像是由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. 最省力的解决方案是构建和维护站点地图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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