Laravel routes not working after go live on linux

Many developers have faced the issue that routes doesn’t work when they go live. Here is the solution which we need to do

sudo a2enmod rewrite && sudo service apache2 restart
sudo nano /etc/apache2/apache2.conf


search for <Directory /var/www/> and change AllowOverride None to AllowOverride All, then save the file and restart apache