I have a new laptop, and am now trying to run a laravel application.
First, am trying to setup a virtual host for the project so that I can access blog.local
I went my hosts file and setup the drivers like the following:
127.0.0.1 localhost
127.0.0.1 test.local
127.0.0.1 blog.local
The for the apache configuration I have the following:
<VirtualHost *:80>
DocumentRoot "C:XAMPPhtdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:XAMPPhtdocsblog"
ServerName blog.local
</VirtualHost>
When I try to access my url I do not see the site but the files only:
For this and future projects, how can I create a local url and see the front-end when I visit it?
2
Answers
You need to address your public folder,
The document root is a directory (a folder) that is stored on your host’s servers and that is designated for holding web pages. When someone else looks at your website, this is the location they will be accessing.
Change the
DocumentRoot
to according to your PHP project is located.Restart the servers after making any changes! If you don’t reset the server to apply the changes, nothing will work even though you know you’ve done everything right.