Apache

How To Enable .htaccess In Apache

.htaccess is a Apache configuration file which is used on running Apache web server software. If we create .htaccess file in web root directory then this file is detected and executed by the Apache web server. It is used to alter the Apache configuration. It is used to enable/disable additional functionality and features. This facilities include basic redirect functionality, for example if a 404 found on the site. This is also used to secure content using password protected or image hot linking prevention.

.htaccess also allow users to override the Apache global and virtual host setting.

Enable .htaccess In Apache

You can edit Apache configuration file or Virtual host configuration file in your favourite editor and add the below directory tag.

In the first directory tag I have disabled using of .htaccess in /var/www/html directory. And in second
directory tag I have enabled the uses of .htaccess for /var/www/vhost directory.

# Disable .htaccess for /var/www/html directory for security
<Directory "/var/www/html">
 Allowoverride none

 
# Enable .htaccess for /var/www/vhost directory and its subdirectories
<Directory "/var/www/vhost/">
 Allowoverride all

Thanks:)

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment