When testing locally I do one of two things.
-
Create a new .htaccess below the public directory with the following.
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(.*)$ public/$1 [L] </IfModule>
-
Create a new virtual host. With WAMP you can navigate to
C:\wamp\bin\apache\YOUR APACHE VERSION\conf\extra
and find yourhttpd-vhosts.conf
file, in there you can see example virtual hosts. Here’s one of mine:<VirtualHost *:80> DocumentRoot "c:/wamp/www/laravel/public" ServerName laravel.dev ServerAlias www.laravel.dev </VirtualHost>
Make sure that your vhosts configuration file is being included. Open up your
httpd.conf
file and search for thevhosts
file, uncomment the include line if it’s commented out. Then I open the CLI and enternotepad "C:\windows\system32\drivers\etc\hosts"
which opens up your hosts file. Underneath the item that mentionslocalhost
place your new host. Here’s an example.127.0.0.1 laravel.dev
Make sure you restart Apache and bingo, you should be able to navigate to
http://laravel.dev
and you won’t have any annoying public directory. This is how I achieve it, as I prefer the nicer looking virtual host rather then a long windedlocalhost
URL.
Hope this helps.