Home Internet What Is Htaccess File -Definition , Working And Usage

What Is Htaccess File -Definition , Working And Usage

0

What is .htaccess file

htaccess is text file on web server . It is used to control the website behavior and security . htaccess is also known as Hypertext Access file . It is a configuration file for Apache-based web servers . It controls a live directory or subdirectories . It is also used to create custom error page such as 404 , 410 .

Htaccess working and usage

It is very useful to control website behavior and protect directories from unautorized access .

Password protection of specific area of website

Almost every website have a private or admin area .You can keep your admin area or private area password protected .This password protection is actually set up in the .htaccess file .

URL rewriting

Using the htaccess file you can rewrite url of your website . You can remove url permanently using 410 redirect , 301 redirect to permanently redirect webpage to other one .You can set a default page for website or set a specific landing page for complete website .

Block visitors by ip address

Using htaccess file you can block specific visitor using ip address .It is a great security feature of htaccess file .

Hot link protection

Hot linking is a type of bandwidth theft .Using .htaccess you can prevent other web sites from sourcing your content and can even display different content in turn.Enable SSL

Enable CGI

If a web server does not allow to run CGI scripts outside of the ‘cgi-bin’ directory, you can do it by enable CGI.

Enable Gzip Compression

Using this feature you can speed up your website loading . So you can Enable Gzip compression using it .

Server time zone settings

You can set server date and timezone using .htaccess.

Adding MIME types

MIME types set what a file is, or rather what file extensions refer to what file types. For example, a ‘.html’ file extension refers to a HTML document, a ‘.zip’ file extension refers to a ZIP archive file. The server needs to know this so it knows how to deal with the file. This is often used to create custom file extension for common file types.

Preventing access on php files

It is also used for web server or website security . PHP files protection is also a great feature of .htaccess file . For example you have a directory containing PHP includes, and you do not wish to be accessed directly from the browser. Then you can disable it using  Mod_Rewrite.

Display scripts as source code

Using it you can prevent the scripts from executing and display them as source codes .

Many others features such as preventing unsecured requests , prevent to access on php.ini and changing server signature are useful features of htaccess file. But Make sure you create an .htaccess file using a plain text editor .Otherwise file will not work . Create a backup of your previous file before make changes . Because using a wrong file will stop your website completely .

How To Create New .Htaccess, Locate it And Edit it