python - 直接在.htaccess中AddHandler

标签 python apache .htaccess mod-python

this solution ,我安装并启用了mod_python

为什么不在.htaccess中添加这个

AddHandler mod_python .py
PythonHandler mod_python.publisher

工作?

如果我将其添加到 <VirtualHost> 中,它就会起作用。配置,但它似乎不适用于 .htaccess 。这有点遗憾,因为有些人无权修改他们的 <VirtualHost>配置,只能修改一个.htaccess .

另一方面,AddHandler php5-script .php似乎可以从 .htaccess 获得如detailed here .

最佳答案

正如 @DusanBajic 在评论中提到的,添加此解决方案:

<VirtualHost *:80>
  ...
  <Directory />
    AllowOverride All
    Allow from all
  </Directory>
</VirtualHost>

然后只需将其添加到 .htaccess 文件中即可:

AddHandler mod_python .py
PythonHandler mod_python.publisher

说明:

  • AllowOverride All :

    When the server finds an .htaccess file (as specified by AccessFileName), it needs to know which directives declared in that file can override earlier configuration directives.

关于python - 直接在.htaccess中AddHandler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59069166/

相关文章:

python - 使用 python 在 Lotus Notes 中发送邮件

python - colorful.core.ColorfulError : the color "default" is unknown. 使用调色板中的颜色(默认为 : X11 rgb. txt)

python - Setup.py:如何添加外部安装候选项?

php - Apache、mod_*、PHP、Perl、Python、Ruby;向后学习

apache - 使用 Virtualmin 设置 Apache 后无法访问网站

php - 使用 htaccess 的 codeigniter seo url

python - 让优化器根据容量和净负载切换电力存储

apache - Visual Studio Code 是否使用 .htaccess?

regex - htaccess 文件用破折号或下划线运行

WordPress .htaccess www。不强制