What is .htaccess File? An Introduction To htaccess Files

0 Flares 0 Flares ×

htaccessThis article is an introduction part of the series of tutorial on .htaccess files. So what is .htaccess file? Why do we use .htaccess files? Similar questions may arise in your mind if you are related to web technologies or if you have newly entered to web world. So in this article I will give a brief explanation about the .htacces files and its usage in short. We can go in details about the usage of htaccess file in later part of this series. So lets get started.


What is .htaccess file?


Well full form of htaccess is “Hypertext Access” and the complete file name is “.htaccess” and it is not a file extension the name of the file itself starts with a dot. In real “.htaccess” file is a directory level configuration file supported by several web servers. That means “.htaccess” file contains some server level configuration settings which is applied to that particular directory where this file is residing. It actually decentralizes the management of web server configuration.


Often many people think that “.htaccess” file is only associated with apache webserver but many webservers are now supporting this htaccess file. The configuration present inside the file are applied to the whole directory and its sub directories. Format of the htaccess file is same as the Apache Web Server‘s Gloal configuration format. Below is an example of htaccess file configuration:

# This allows you to redirect index.html to a specific subfolder/URL
Redirect /index.html http://example.com/myurl/

The above example will redirect the request to the new URL  http://example.com/myurl/.  In this case the file has to be kept in the root directory of the sweb erver as we are redirecting the /index.html to some other url. This is just a small and simple example. There are lot many you can do with htaccess configuration.

You can create a .htaccess file using any standard text editor such as TextPad,  Microsoft WordPad and similar but you cannot use Microsoft NotePad as it will not allow you to save it with a starting dot.


Advantage of .htaccess


Immediate changes:
Changes made in these files take immediate effect as .htaccess files are read on every request.You don’t need to restart the server.


Demerit Of .htaccess


Performance loss:
For each HTTP request, there are additional file-system accesses for parent directories when using .htaccess, to check for possibly existing .htaccess files in those parent directories which are allowed to hold .htaccess files.


Allowing individual users to modify the configuration of a server can cause security concerns if not set up properly.

This is just an introduction to the htaccess files. In the next tutorials we will see lot more about different configuration option of htaccess.


+Ayodhyanath Guru holds a B.Tech degree in Electrical Engineering and has worked with various prestigious clients in the IT industry and presently working as a Software Engineer. He is a part time blogger and presently authors the Jafaloo.Com blog. Being a tech enthusiast Guru likes to surf the web and blogs about interesting technical topics like How-To guides, freewares, Tutorials, Software, Gadgets, web applications etc. Apart from blogging he likes coding in Java/J2EE and PHP.

You may also like...

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 0 Flares ×