Wednesday 11 February 2015

An Overview About .htaccess

.htaccess file is a directory-level configuration file that is used with apache server to enable the additional feature such as 301 and 302 redirect, block IP, Change server signature and many more. To create an .htaccess file you can use any text editor the only thing that matter is when you upload your .htacces file it must be in “ASCII” mode.

Below we have listed few benefits of .htaccess that make them desirable among developer and digital marketer. 

Redirect Page
This feature give you the authority to redirect your any internal page with another page. Hence if you want to relocate visitors from old page to new one, you can redirect it.
Redirect /Old/ http://www.yourdomain.com/New/index.html

Offer authorized user accessibility 
It is one of the most important and famous feature of .htaccess. With this feature you can allow limited user to access the website or particular area of website you want to be” password protected”
AuthName "Member's Area Name"
AuthUserFile /path/to/password/file/.htpasswd
AuthType Basic
require valid-user

Block spam Traffic
You can also block traffic from any spam domain or IP address on your website with the support of .htaccess. Hence if you are eager to block any IP or domain and don’t want traffic from that IP, you can block it.
order allow,deny
deny from 458.0.8.0
deny from 823.4.6.9
allow from all

Assist SSI with .htaccess
Acronym SSI refer to “Server Side Includes”, these are the significant tags which are used in HTML document file to call CGI script. Hence if you modify your content using .htaccess it will not occupy more disk space. To enable SSI on your website you need to create an .htaccess file as listed below.
AddHandler server-parsed .html

Conceal Directory Listing
With the support of .htaccess you can also hide the directory listing for instance if your website involves a directory containing important data that you don’t want to be publicly visible. You can prevent viewing of your data using .htacces. To prevent your directory you just need to add extension with the below code.
IndexIgnore *

Media File Download option
If you want to make sure that your media file will always download rather than run on browser. It should be possible with create an .htaccess file. 
AddType application/octet-stream .zip .mp3 .mp4

Update time zone and Server Signature
You can also update your server time zone using below code in .htaccess file.
SetEnv TZ America/Indianapolis
Also With .htaccess you can update or remove your server signature. 
ServerSignature EMail
SetEnv SERVER_ADMIN nospace@pleasenospace.com

No comments:

Post a Comment