问题
I have a quick issue. I am trying to use Laravel for the first time. To do so, I'm using Wamp. And I don't know if this is important, but I set the DocumentRoot of wamp at this address :
DocumentRoot "C:\Users\Bebop\Documents\Site Internet/"
I using wamp for a lot of different websites in a folder called Sites. When I access to one of the site I go to : localhost/Sites/thewebsite. So really what I want is just to get rid of the public folder in the path to the Laravel website.
For the moment I've did :
Change httpd.conf of apache to include vhosts.conf :
Include conf/extra/httpd-vhosts.conf
Created a new Virtual hosts and configured the directory like so :
DocumentRoot "C:/Users/Bebop/Documents/Site Internet/Sites/LaravelTest/public" ServerName Sites/LaravelTest
Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from 127.0.0.1
After that I added a new host in the file located at C:\Windows\System32\drivers\etc
127.0.0.1 localhost
127.0.0.1 Sites/LaravelTest
By doing this, when I go to localhost I get redirected to the Laravel websites. But I would like to go to localhost/Sites/LaravelTest, because now I can't access to all my other websites.
Does anyone know how to do that ?
Thanks a lot for your help
回答1:
Assuming that you want to reach your Laravel site at: http://localhost/LaravelSite/
You can either use an alias in your httpd.conf
file:
Alias /LaravelSite/ "C:/Users/Bebop/Documents/Site Internet/Sites/LaravelTest/public/"
<Directory "C:/Users/Bebop/Documents/Site Internet/Sites/LaravelTest/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
or, create a symbolic link under command-prompt with the following:
mklink /D "C:\Users\Bebop\Documents\Site Internet\Sites\LaravelSite" "C:\Users\Bebop\Documents\Site Internet\Sites\LaravelTest\public"`
来源:https://stackoverflow.com/questions/15468608/how-to-get-rid-of-the-public-path-in-laravel-on-wamp