. Htaccess file is a simple ASCII text file located in your www directory or in a subdirectory folder www. We can create or edit this file in Text Editor (Notepad) and then upload it to the directory we want to change its setting. Make sure that the file isuploaded in ASCII not BINARY format, and make sure the file permissions for the filewas set to 644 (rw-r-r-). This allows the server to access the files but prevent users toaccess files from their browser.
- Prevent Access To. htaccess
Add the following lines to increase the security of. htaccess file so that if there is anyattempt to access the file will display an error message 403. Of course do not forget togive file permissions to 644. - Prevent Access to Specific Files
To restrict access to certain files we can use the following command. Change name rahasia.txt be according to our needs. Later, the file will be hidden and if there is attempt to access the file will be an error 403. - Prevent Access To Many Files
We can replace some extensions below in accordance with what we need. - Prevent Users To Browsing On Every Directory Our Server
- Allow Users To Browsing
If we allow users to do browsing on “directory that we have set” simply add the command as below. (Simply put. htaccess file in the folder you want) - Prevent Users Browsing Without Doing 403 Error Messages
- Prevent Users To Restrict Browsing With Extension Files.
- Changing the Index Files
By default when we create several files and one of them there are index files, the file tersebutlah to be run first. By using. htaccess we can turn it into a file name we want. - PHP Extension disguise
This is very useful to add security in PHP applications that we make. We can replace the php extension in our application with the extensions that have been registered by us, probably “geje”, “crot”, etc.. Now with the following code, the file will still be read as a PHP file. A note, usually I find the httpd.conf file and add extensionnya there, but this is the excess. htaccess. We do not need to change the original setting on the Apache. - Restrict access to the LAN (Local Area Network)
- Automatic Giving To Each File CHMOD
- Protect From Attacks DOS (Denial Of Service) With Limiting Upload File
This is one simple method that we can use to prevent DOS attacks. Here we limit the upload size of 10240000 bytes equal to 10 mb. - Mengamankan Direktori Dari Pengeksekusian Script Atau File
<Files .htaccess> order allow,deny deny from all </Files> |
<files rahasia.txt> order allow,deny deny from all </files> |
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$"> Order Allow,Deny Deny from all </FilesMatch> |
Options All -Indexes |
Options All +Indexes |
IndexIgnore * |
IndexIgnore *.wmv *.mp4 *.avi *.3gp |
DirectoryIndex home.php |
AddType application/x-httpd-php .r3m1ck |
Sponsored links
<Limit GET POST PUT> order deny,allow deny from all allow from 192.168.21.22 </Limit> |
chmod .htpasswd files 640 chmod .htaccess files 644 chmod php files 600 |
LimitRequestBody 10240000 |
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi Options -ExecCGI |
Tags: .htaccess security, secure your web using htaccess.using htaccess, tips htaccess, trick htaccess
muanteb mas remik hahha :P