Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Web Servers»Apache»How to Enable .htaccess in Apache Web Server

    How to Enable .htaccess in Apache Web Server

    RahulBy RahulAugust 2, 20171 Min ReadUpdated:December 15, 2018

    Question:- How to enable .htaccess for Apache web server? How to enable .htaccess for Apache virtual hosts? How to enable .htaccess uses in httpd server?

    The .htaccess enable the directory level configuration for the Apache server. This allows users to override the Apache global and virtual host settings.

    Enable .htaccess in Apache

    Edit Apache virtual host configuration file in your favorite editor and add the following Directory tag.

    Update /var/www/html with your application document root.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <VirtualHost *:80>
    ServerName example.com
     
    # Disable .htaccess for /var/www directory for security
    <Directory "/var/www">
    Allowoverride none
    </Directory>
     
    # Enable .htaccess for /var/www/html directory and its subdirectories
    <Directory "/var/www/html">
    Allowoverride all
    </Directory>
    </VirtualHost>

    The first directory tag will disable using of .htaccess in /var/www directory. The second directory tag will enable the use of .htaccess under /var/www/html directory.

    Apache directory htaccess
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Change Apache Default Page with htaccess
    Next Article How to Enable CSF Firewall Web UI

    Related Posts

    How To Install Apache Solr 9.0 on Fedora 36/35

    Updated:May 26, 20223 Mins Read

    How to Install Apache ActiveMQ on Ubuntu 22.04

    3 Mins Read

    How to Install Apache, MySQL, PHP (LAMP Stack) on Ubuntu 22.04

    Updated:June 28, 20225 Mins Read

    How To Disable HTTP Methods in Apache

    Updated:December 31, 20212 Mins Read

    How To Setup Apache, PHP & MongoDB in Ubuntu & Debian

    Updated:October 8, 20213 Mins Read

    Common Apache Commands on Ubuntu & Debian

    4 Mins Read

    2 Comments

    1. Jackson Chacko N on October 3, 2019 1:44 pm

      Hi,
      basically i am new in this field .what my requirement is when i type my domain in URL it shows a page but what i need is when i type a URL it should automatically direct URL/query-string
      at present i have to type Manuel y query-string along with URL

      IE
      domain name.com, if i type domain name.com it should automatically direct to domain name.com/academy.
      how can i write the htaccess fole for the same centos7 httpd

      Reply
    2. Jackson Chacko N on October 3, 2019 1:40 pm

      Hi,
      basically i am new in this field .what my requirement is when i type my domain in URL it shows a page but what i need is when i type a URL it should automatically direct URL/query-string
      at present i have to type Manuel y query-string along with URL

      IE
      ias.enfinlabs.com it i type ias.enfinlabs.com it should automatically direct to ias.enfinlabs.com /academy.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.