The .htaccess is a configuration file for use on web servers, it is supported by Apache Web server and others several webservers. An .htaccess (hypertext access) file is a directory-level configuration file,it is hidden file in Unix-based environments. .htaccess file causes server performance
The following use of .htaccess file.
Always script is executed on server but you want to view as source code or you want to directly download. By .htaccess file you can do by spripping the script handler for particular types of file.
#view as source code RemoveHandler cgi-script .php .py AddType text/plain .php .py
MIME : Multipurpose Internet Mail Extensions, For the directive there are three parts :
#These file extensions to download by default AddType text/plain .php .py AddType application/octet-stream pdf
CGI(Common Gateway Interface) is a server-side method, it is used to includes non-HTML scripts like Perl, SSI , etc
AddHandler cgi-script .cgi Options +ExecCGI
Options -ExecCGI AddHandler cgi-script .php .py .cgi
When in directory with documents but no index.html file then all files name will display of director so You used enabling an Index
Options +Indexes
Options -Indexes
#To show all files except pdf and png files IndexIgnore *.pdf *.png #To show all files except test.png file IndexIgnore test.png
You can change the php.ini settings also by .htaccess file.
#sytanx php_value [setting_name] [value] #Example php_value post_max_size 30M php_value upload_max_filesize 40M