htaccess Tutorial

In this htaccess tutorial series, you will learn about htaccess configuration and it’s usage.

htaccess Tutorial

htaccess refers to Hypertext Access. It is a directory level configuration file, used by Apache Web Server.  htaccess file contains set of directives, which is read by Apache web server and apply to the directory on which this file is placed.

In htaccess file, we write Apache directives. So what is directives.Directives is a short

Directives is a short commands used to modify Apache’s behaviour. You can check complete Apache Directives and it’s Meaning.

NOTE – htaccess overrides apache main configuration file (httpd.conf) settings for the directory in which it placed.

Apache Main Configuration File Path

For Febora and CentOS – /etc/httpd/conf/httpd.conf

For Debian and Ubuntu – /etc/apache2/apache2.conf

* In new versions, may be this path differ.

How to Enable .htaccess File

Why htaccess File is Useful

htaccess file is useful when you don’t have a direct access of httpd.conf (Apache configuration) file.

In case of shared hosting, you don’t have a direct access of Apache configuration file (httpd.conf). Take another scenario, suppose you want to host multiple websites on a single server . And also you want to keep different configuration for each website then htaccess file would be ideal for you.

To use htaccess file, you need to enable it first.

Subscribe Our Tutorials

Get Latest Updates on Facebook

htaccess File Usage

1. You can use .htaccess file to create SEO-Friendly URLs.

2. It can be used for security purposes such as deny access of files and folders,  Password protect folder and directory.

3. Used for URL redirection.

4. In the case of shared hosting, you can use this file to leverage browser caching.

There are many other amazing things you can do with htaccess file.

NOTE:  Always take care while making changes in htaccess file, any error will lead to  500 Internal Server Error.

Does usage of htaccess file slows down website

If you have an access of main configuration file (httpd.conf) then avoid use of htaccess. Using htaccess file slows down Apache HTTP server, which impacts website speed.

Read htaccess Complete Explanation.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , , . Bookmark the permalink.