Already discussed disabled directories in .htaccess now let do in httpd.conf file. We can block the hidden files and directories in the apache, Open the httpd.conf file and add the below lines,

# vim /etc/httpd/conf/httpd.conf

The below lines to prevent any .files viewed by web clients,

#Blocked .files 
<Files ~ "^\.">
Order allow,deny
Deny from all

Finally restart your httpd service,
# service httpd restart