Apache2 | http.conf How do I set AllowOverride All on a directory

5,844

The file that you are looking for is probably in /etc/apache2/sites-enabled/000-default.conf or similar.

You can create the Directory tags yourself in /etc/httpd.conf, /etc/apache2/sites-enabled/000-default.conf, or in a new file placed in /etc/apache2/sites-enabled/example.conf

Below is what you need to include in one of the files mentioned above:

<Directory /path/to/directory-name>
AllowOverride All
</Directory>

Apache will load this directory block from any of the configuration files. I imagine that you are probably used to putting this in the default block that had previously been located in the /etc/apache2/httpd.conf file. The default DocumentRoot and Directory tags still exist but are probably located in /etc/apache2/sites-available/000-default.conf.

You may also consider creating a new configuration file for your specific website in /etc/apache2/sites-available/example.conf. Then placing within that file, something like this:

<VirtualHost *:80>
ServerName site-name.com
ServerAlias other-name.com www.site-name.com
DocumentRoot /path/to/application
    <Directory />
        AllowOverride All
    </Directory>
</VirtualHost>

By default Apache will load configuration from any file that is located in /etc/apache2/sites-enabled/* that ends in .conf

Share:
5,844

Related videos on Youtube

Félix Desjardins
Author by

Félix Desjardins

An anwer when I need it #SOreadytohelp

Updated on September 18, 2022

Comments

  • Félix Desjardins
    Félix Desjardins over 1 year

    I have to set AllowOveride to All on my web server, but in my httpd.conf file, there is no <Directory> tag for me to place it in.

    I never seen this before. What can I do? Where is the file I have to change?

    I am on a LAMP server, and Debian7, with Apache2.

    Thanks!

  • Marki555
    Marki555 almost 9 years
    At least on debian there is command a2ensite which will make the symlink from sites-available to sites-enabled for you (but you can make it also manually).
  • Félix Desjardins
    Félix Desjardins almost 9 years
    Thanks for your answer. Only one thing that I noticed. The 000-default file should have an .conf extension, right?
  • Jacob Margason
    Jacob Margason almost 9 years
    yes, if you look inside httpd.conf you will see that near the bottom, there is: Include sites-enabled/*.conf You could ofc change that so that any file will be loaded in. You can also manually include any file: Include /path/to/file