By samsfolk
I have a .htaccess file which has the following directive …
Options -ExecCGI AddHandler cgi-script .php .php3 .php4 .php5 .pl .py .jsp .asp .htm .shtml .sh .cgi
It has been placed in the directory, that I do not want files with .php extensions to be accessed. Within /etc/apache2/apache2.conf , I’ve adjusted AllowOverride to All as in the following.
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
The .htaccess works by not allowing permission to access files, of every extension in the list, except .php type files. Of course, .php files are the ones, I’m really wanting not to allow permission too. This file is not for actual production use. Just for tinkering about. It use to work several years ago, but upon returning to use it now, it will not work. The Web hasn’t been useful for an answer. Thanks ahead for any direction.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Since php is handled by it’s own handler you will need to disable this. I recommend adding the following to your .htaccess file to disable php for the directory:
RemoveHandler .php .phtml .php3
RemoveType .php .phtml .php3
php_flag engine off
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.