3

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

Thoma Biguères
  • 1,136
  • 4
  • 18
  • 42

1 Answers1

2

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"`
tolgamorf
  • 809
  • 6
  • 23
  • Thanks a lot, it helped. I have a last question though. Does this mean that I cannot use Laravel on a mutualized host or shared hosting, and that I have to have a dedicated host to use it ? – Thoma Biguères Mar 18 '13 at 11:22
  • No, you can use Laravel on shared hosting. I do it using symbolic links. – tolgamorf Mar 18 '13 at 18:47
  • When I use mklink on windows with Laravel, all my GET requests work, but I get a 404 on POST requests. Any idea why? – Tom Nov 11 '14 at 09:06
  • Are you sure that issue is related to mklink? Were your POST requests working prior to using mklink, i.e., for the `laravel/public/` path? – tolgamorf Nov 12 '14 at 21:43