.htaccess... AddHandler cgi-script php... Options -ExecCGI
I have a .htaccess file which has the following directive …
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.
Options Indexes FollowSymLinks
Require all granted
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.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.