I finally managed to load my laravel project on my vps and everything was going well until I noticed that except for the home page, all other pages were returning a 404 error. I did all these instructions but it didn't fix it.
php artisan view:cache
php artisan route:cache
php artisan config:cache
php artisan key: generate
But the other pages were not loaded at all. The rewrite module is also active
First, enable rewrite mode
sudo a2enmod rewrite
sudo service apache2 restart
Then
nano /etc/apache2/apache2.conf
Change Following
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Into
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Then again restart apache
sudo service apache2 restart
If this is not working change the your-domain.conf
file following the above steps.
this file will be located at
/etc/apache2/sites-available/your-domain.conf
As I see in your comment, the above file will contain a code block like
<Directory /var/www/html/myproject/public>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Change it into
<Directory /var/www/html/myproject/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Finally
sudo service apache2 restart