如何禁用CGI htaccess的在非扩展相关的方式? [英] How to disable cgi in htaccess in a non-extension dependant way?

查看:269
本文介绍了如何禁用CGI htaccess的在非扩展相关的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用任何类型的CGI执行下面我的文档根目录的目录。任何一种:PHP,Perl中,红宝石...等等。我想做到这一点的方式是不是depensant文件扩展名。下面我的文档根目录,因为用户必须能够把看到的HTML文件。

I would like to disable any kind of CGI execution in a directory below my document root directory. Any kind: php, perl, ruby... whatever. I would like to do it in a manner it's not depensant of the file extension. Below my document root because users have to be able to put and see HTML files.

它是在htaccess的,因为它是一个共享主机。

It has to be in htaccess, because it's a shared hosting.

使用-ExecCGI不能单独工作。我要补充到该线路上的AddHandler指令是扩展依赖。

Using -ExecCGI alone is not working. I have to add to that line a AddHandler directive which is extension dependant.

我已经找到<一href="http://stackoverflow.com/questions/1271899/disable-php-in-directory-including-all-sub-directories-with-htaccess">some在这个话题接近的答案,但它们的扩展依赖,PHP相关的或全球性的Apache配置有关。

I have found some close answer in this topic, but they are extension dependant, php dependant or global apache configuration dependant.

是否有可能做我想要什么?

Is it possibly to do what I want?

非常感谢你,

推荐答案

RemoveHandler .suffix ,其中 .suffix 是文件名后缀要禁用应该这样做脚本的类型。

RemoveHandler .suffix where .suffix is the filename suffix for the type of a script you want to disable should do it.

寻找的东西,不允许脚本一般现在。

Looking for something that disallows scripts in general right now.

编辑:啊哈!如果你不介意,以服务中的所有目录中的静态内容 - 你可能不这样做,这就是你的问题似乎在暗示 - 你可以只设置的默认处理该位置

Aha! If you don't mind having to serve everything in the directory as static content — you probably don't, that's what your question seems to imply — you could just set the default handler for that location.

<Directory something>
    SetHandler default-handler
</Directory>

默认处理程序是核心所以这不应该依赖于任何东西。纠正我,如果我错了。

default-handler is in core so this shouldn't depend on anything. Correct me if I'm wrong.

这篇关于如何禁用CGI htaccess的在非扩展相关的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆