what is .htaccess and how to setup a .htaccess file?
|Hypertext Access, know as htaccess, is a configuration file which controls the directory it is placed in and all the subdirectories underneath it. It is used on apache web server to control many features of server. It’s just a small text file that can be edited via notepad or any text editor but make sure never save it as .txt or .htm , Its only name is .htaccess. It can be found in server’s root directory in public_html folder.
Some web host server never allow you to edit htaccess, but you can create your own .htaccess file via any text editor and saved it as .htaccess and place it in your web directory. It will control all subdirectory in it.
Basic use of htaccess –
Htaccess is used for redirection like temporary 302 , 301 permanent redirection. It can be used to redirect error pages for better visitor expierence.
Htaccess files are normally enabled by default. This is actually controlled
by the AllowOverride Directive in the httpd.conf file. With htaccess file we can block specific IP, websites, spam links etc. We can also block search engines to crawl our websites.
How to deny an IP –
#Deny List
order allow,deny
deny from 100.100.100.100 #specify a specific address
deny from 123.123.123.123/30 #specify a subnet range
deny from 123.123.* #specify an IP address wildcard
allow from all
How to allow an IP –
#Allow List order allow,deny
allow from 123.123.123.123 #specify a specific address
allow from 123.123.123.123/30 #specify a subnet range
allow from 123.123.* #specify an IP address wildcard
deny from all
I read a lot of interesting posts here. Probably you spend a lot
of time writing, i know how to save you a lot of time, there is an online tool that creates high quality, google friendly articles in minutes, just search in google – laranitas free content source
Hi Annis, i loves to write so don’t need any shortcuts..