Using virtual hosts in apache can help you manage multiple Laravel application endpoints.
First, you need to ensure that you have mod_rewrite enabled on your apache setup. If not then you can do that:
Now copy the default configuration and make a new one with a new name:
Now open the newly added secret-project.conf
configuration file. (you can name it whatever you want)
Remove the existing content in this copied file and add the following:
In the above configuration, we have registered a name for our Laravel installation so when we open secret-project.local in the browser, we would be able to see our Laravel application.
But before we proceed further and try to access quick.local, we have to add an entry in the hosts file:
Add this line at the end of the hosts file:
Everything is set now. Enable your newly added secret-project.conf configuration and reload the apache2:
Now you can open your browser and navigate to secret-project.local
and you should be able to see the Laravel page.
In case you get an error on the page, make sure you set up the permissions on the cache and storage folder: