When setting up a fresh Laravel installation, we have to run it using domain.com/public instead of domain.com.
I googled after this problem and I saw that this could be because of mod_rewrite
not being enabled. However, we are running Plesk on our server and their documentation at http://download1.parallels.com/Plesk/PP12/12.0/Doc/en-US/online/plesk-administrator-guide/index.htm?fileName=74206.htm says:
The mod_rewrite module is enabled by default in Apache that comes with Plesk for Linux. To make use of the functionality, you will need to create an .htaccess file containing the desired rewrite rules - refer to the Apache documentation for more information.
Laravel is working fine, if I move the contents of public in the main folder, and the rest in a /laravel folder (simply have to adopt the main index.php file).
However I would like to keep the original file structure.
Any tips?
2
Answers
Just use .htaccess to redirect from / to /public. Maybe similar to this
You need two .htaccess files. One inside the Laravel Project and the other one inside your domain.com
Laravel Project (/var/www/vhosts/domain.com/public/.htaccess)
main domain (/var/www/vhosts/domain.com/.htaccess)