Document Root and AllowOverride in Apache's config for Arch Linux

Draft (work in progress) -- AWAITING PEER REVIEW

This lesson teches the basics of Apache configuration and about the document root


Document Root
Apache by default serves from a folder specified in the Document Root directive in it's configuration. For arch linux, the default document root is /srv/http folder. This means that suppose you place a file named hello.html in the /srv/http folder, you can access it be going to the url http://localhost/hello.html in your web-browser.
Similarly, if you place the drupal folder in /srv/http directory and its name is drupal, you can access it by going to http://localhost/drupal

AllowOverride and .htaccess file
Apache also supports directory-level configuration which can be specified for a particular directory in a file named .htaccess in that directory. Drupal also has a specific .htaccess file which is present in the drupal folder. There is a directive in the apache configration by the name AllowOverride which specifies whether to ignore or consider the .htaccess file of a directory. By default, it is set to None for the document root which means that apache will ignore the .htaccess file in that folder.

To change this,
1. open the apache configuraiton file
sudo nano /etc/httpd/conf/httpd.conf

2. Search for <Directory "/srv/http"> in the config

3. You will find a line AllowOverride None in a line after the previous line but before the line </Directory>.
Change "None" to "All"

4. Restart Apache
sudo systemctl restart httpd