#!/bin/bash
# cpanel check
if ! [ -f "/usr/local/cpanel/cpanel" ]; then
       echo "-" | tee $OUTFILE
       exit
fi

cpl -dr  | awk  '{print $NF}' >  /root/pdocroots.txt
cat /root/pdocroots.txt | while read pdocroot ; do 
find $pdocroot  -type d -name ".well-known" 2>/dev/null | while read -r dir; do
cat > "$dir/.htaccess" <<'EOF'
RemoveHandler .php .phtml .phar .pht .php3 .php4 .php5 .php7 .php8
RemoveType .php .phtml .phar .pht

<FilesMatch "\.(php|phtml|phar|pht|php[0-9])$">
    SetHandler none
    Require all denied
</FilesMatch>
EOF

echo "Created: $dir/.htaccess"
done
done
