I have a Laravel installation in Xampp and i configured a virtualhost with the url “http://laravel.test” so i don’t have to write “http://localhost/laravel5-upaetest/public/“.
The problem is that now whenever i write the url “http:laravel.test” in my browser it takes me to the root of the htdocs folder and when i write “localhost” it takes me to my laravel project folder.
How can i fix it? the idea is that when write laravel.test it takes me to my project in laravel5-upaetest/public.
This is my httpd-vhosts.conf file:
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##ServerAdmin [email protected]
##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
##ServerName dummy-host.example.com
##ServerAlias www.dummy-host.example.com
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>
##<VirtualHost *:80>
##ServerAdmin [email protected]
##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
##ServerName dummy-host2.example.com
##ErrorLog "logs/dummy-host2.example.com-error.log"
##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>
<Directory c:/xampp>
AllowOverride All
Require all granted
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot c:/xampp/htdocs/laravel5-upaetest/public
ServerName laravel.test
</VirtualHost>
3
Answers
enter image description here
I Think, You already use all types of work.
these lines
explain your issue – you’ll want to have two blocks in your
httpd-vhosts.conf
with the first being the generic server files path:other things to check would be to restart apache. any config changes (*.conf like the vhosts file) will require a restart of the server to load them.
you can also add
AccessLog
andErrorLog
directives to see what’s going on (see the commented out##
lines for examples, check the log files for any messages).you’ll probably want to add
127.0.0.1 laravel.test
to yourhosts
file, which for Windows can live in egC:WindowsSystem32driversetc