douqinlu4217 2013-09-17 07:09
浏览 58
已采纳

对于没有索引页面的文件夹,禁止生成403 [关闭]

I have a webserver and I need to create a 403 forbidden for all folders ( include sub folders) that do not have any index file , I know I can do it with .htaccess , but as far as I know It only used for main folder , not sub folders . how can I block accessing website folders that do not have index file ?

thanks

  • 写回答

2条回答 默认 最新

  • donglu7816 2013-09-17 08:04
    关注

    Even with DirectoryIndex on this rule should work for you:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{DOCUMENT_ROOT}/$1/index.php !-f
    RewriteRule ^(.+?)/?$ - [F]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用verilog实现tanh函数和softplus函数
  • ¥15 Hadoop集群部署启动Hadoop时碰到问题
  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 QTableWidget重绘程序崩溃
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站