Step 1: Use below comment to install
sudo a2enmod rewrite
Step 2: After successful install, restart the apache using below comment.
service apache2 restart
or
sudo /etc/init.d/apache2 restart
Step 3: Check the site to confirm 404 error fixed or not.
Step 4: To fix the issue, go to “/etc/apache2/apache2.conf ” and edit apache2.conf using below comment.
vi apache2.conf
Step 5: Replace the “AllowOverride None” with “AllowOverride All”. So, it will be look like below image.
Step 6: Use “Esc” and type “:wq” comment to save and quit after completed the changes.
Step 7: Reload apache using below comment.
apache2 reload
OR
systemctl restart apache2
Step 8: I hope your issue fixed now.
Step 9: Still you have the issue! Please follow the below reference image instruction. I hope, this is more helpful for you. (Click below image to view)