sudo a2enmod rewrite sudo a2enmod headers sudo nano /etc/apache2/sites-available/default
On running the last command, Ubuntu’s in-terminal text editor should open up the Apache2 config file. Find the line - <Directory /var/www/> and change AllowOverride to All from None. Save the file by pressing Ctrl+X, followed by Ctrl+Y and then Enter.
oestart Apache2 by entering the following command: