Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent apache from running python script

I wanted to host a .py file on my website, for download, but instead Apache runs it as a CGI script.

If I don't have executable flag on it, I get an error 500.

Is there any way to disable running of this file, maybe with htaccess? I don't have full control over the machine, so can't alter apache config.

like image 620
MightyPork Avatar asked Sep 02 '26 11:09

MightyPork


1 Answers

Derp, found it

Solution is to put this in a .htaccess where I want to block it:

RemoveHandler .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo
like image 194
MightyPork Avatar answered Sep 05 '26 00:09

MightyPork



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!