All the tutorials tell me to edit the: /etc/apache2/sites-available/default but this file doesn't exist for me. Within this file I would have to edit the:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#AllowOverride All
#AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews        
Order allow,deny
allow from all </Directory>

What should the file look like and should I create it myself?

Aslo I do have a 000-default.conf file but the above 'code' isn't in there either.

up vote 42 down vote accepted

New apache version has change in some way. If your apache version is 2.4 then you have to go to /etc/apache2/. There will be a file named apache2.conf. You have to edit that one(you should have root permission). Change directory text like this

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

Now restart apache.

service apache2 reload

Hope it works.

  • Its work for me thanks – Abhijit Jagtap Aug 16 '16 at 21:24
  • Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all. – chx101 Apr 16 '17 at 10:04

Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.

firstly enable a2enmod

sudo a2enmod rewrite 


sudo service apache2 restart

sudo nano /etc/apache2/sites-enabled/000-default.conf

add these lines at end

<Directory /var/www/html>
    AllowOverride All


sudo service apache2 restart
  • 1
    This solution works for me because, I need to enable mod_rewrite first. Thanks a lot. – kishor10d Sep 29 '17 at 18:16
  • 1
    This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked. – Faisal Sarfraz Sep 7 at 7:51

If you don't want to repeat the same configurtion at each upgrade / update

The best way is :

Edit or creat config file



<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>

Enable the config file

sudo a2enconf httpd

Restart or reload Apache

sudo service apache2 restart


sudo service apache2 reload

It's done!

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.