public function htaccessDeny(string $dir, bool $allow_static_access = false): int
    {
        $deny = // `.htaccess` file.
            '<IfModule authz_core_module>'."\n".
            '	Require all denied'."\n".
            '</IfModule>'."\n".
            '<IfModule !authz_core_module>'."\n".
            '	deny from all'."\n".
            '</IfModule>';

        if ($allow_static_access) {
            $deny .= "\n\n".// Allow these file extensions.
            '<FilesMatch "\.(js|css|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">'."\n".
            '	<IfModule authz_core_module>'."\n".
            '		Require all granted'."\n".
            '	</IfModule>'."\n".
            '	<IfModule !authz_core_module>'."\n".
            '		allow from all'."\n".
            '	</IfModule>'."\n".
            '</FilesMatch>';
        }
        return (int) file_put_contents($dir.'/.htaccess', $deny);
    }
public function htaccessDeny(string $dir, bool $allow_static_access = false): int
    {
        $deny = // `.htaccess` file.
            '<IfModule authz_core_module>'."\n".
            '	Require all denied'."\n".
            '</IfModule>'."\n".
            '<IfModule !authz_core_module>'."\n".
            '	deny from all'."\n".
            '</IfModule>';

        if ($allow_static_access) {
            $deny .= "\n\n".// Allow these file extensions.
            '<FilesMatch "\.(js|css|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">'."\n".
            '	<IfModule authz_core_module>'."\n".
            '		Require all granted'."\n".
            '	</IfModule>'."\n".
            '	<IfModule !authz_core_module>'."\n".
            '		allow from all'."\n".
            '	</IfModule>'."\n".
            '</FilesMatch>';
        }
        return (int) file_put_contents($dir.'/.htaccess', $deny);
    }
public function htaccessDeny ( string $ dir , bool $ allow_static_access = false ) : int { $ deny = // `.htaccess` file. '<IfModule authz_core_module>' . "\n" . '	Require all denied' . "\n" . '</IfModule>' . "\n" . '<IfModule !authz_core_module>' . "\n" . '	deny from all' . "\n" . '</IfModule>' ; if ( $ allow_static_access ) { $ deny .= "\n\n" . // Allow these file extensions. '<FilesMatch "\.(js|css|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">' . "\n" . '	<IfModule authz_core_module>' . "\n" . '		Require all granted' . "\n" . '	</IfModule>' . "\n" . '	<IfModule !authz_core_module>' . "\n" . '		allow from all' . "\n" . '	</IfModule>' . "\n" . '</FilesMatch>' ; } return ( int ) file_put_contents ( $ dir . '/.htaccess' , $ deny ) ; }
Deny public access.

@since 160522 Apache utilities.

@param string $dir                 Directory to deny access in.
@param bool   $allow_static_access Allow static file access?

@return int Number of bytes written to file.
Deny public access .