在this solution中,我安装并启用了mod_python。
为什么不在.htaccess中添加这个
AddHandler mod_python .py
PythonHandler mod_python.publisher工作?
如果我将它添加到<VirtualHost>配置中,它就能工作,但它似乎不能从.htaccess中运行。这有点遗憾,因为有些人无法修改他们的<VirtualHost>配置,只能修改.htaccess。
另一方面,AddHandler php5-script .php似乎可以从.htaccess中获得detailed here。
发布于 2019-11-27 20:23:18
正如@DusanBajic在一条评论中提到的,他补充道,这解决了这个问题:
<VirtualHost *:80>
...
<Directory />
AllowOverride All
Allow from all
</Directory>
</VirtualHost>然后,只需将其添加到.htaccess文件中即可:
AddHandler mod_python .py
PythonHandler mod_python.publisher解释:
当服务器找到一个.htaccess文件(如AccessFileName所指定的)时,它需要知道在该文件中声明的哪些指令可以覆盖以前的配置指令。
https://stackoverflow.com/questions/59069166
复制相似问题