Hope this will fix your problem who are facing even after going through all the steps
sudo nano /etc/apache2/sites-available/000-default.conf
add these lines below “Document root”
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
<Directory /var/www/>
AllowOverride all
</Directory>
or in case of multiple websites
sudo nano /etc/apache2/sites-available/example.com.conf
add these lines below “Document root”
<Directory /var/www/example.com/>
AllowOverride all
</Directory>
then restart apache