.htaccess与SetHandler application / x-httpd-php一起显示/ directory的索引

时间:2019-02-14 13:02:13

标签: php apache .htaccess

我在SetHandler application / x-httpd-php中使用.htaccess文件在URL中info /之后传递任何内容,以使用和处理该信息文件。

因此www.sitename.com/folder/ 信息 /text/file.html将处理信息文件。

.htaccess文件具有以下内容:

// Question #2:
// Write a function checkBasket() that lets you know if the item is in the basket or not
const amazonBasket = {
  glasses: 1,
  books: 2,
  floss: 100
}

function checkBasket(basket, lookingFor) {
  for(item in basket) {
    console.log(item);
     if(item === lookingFor) {
      return `${lookingFor} is in your basket`;
    }     
   }
   return `${lookingfor} is not in your basket`;
}

我现在尝试停止目录浏览,因为仅使用www.sitename.com/folder/时,它显示/目录的索引并列出其中的所有文件名。这可能吗?

我对如何解决没有太多的想法,所以任何帮助或建议都将不胜感激。我曾尝试如下所示将选项All –Indexes添加到.htaccess中,但这会造成内部服务器错误。

<Files info>
SetHandler application/x-httpd-php
</Files>

0 个答案:

没有答案