After much faffing about I got laravel to work with XAMPP. However, I can't seem to access directories in the htdocs folder via localhost now. Attempt to access a file returns Object not found!
along with The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
The changes I made to get laravel working seems like a blur now. The only thing I remember doing is editing the hosts
file to enable the virtual host to work by adding 127.0.0.1 laravel.dev
in the hosts file (using a mac btw). I also added a virtual host to the httpd-vhost.conf file.
I did undo the above changes but it didn't make a difference.
Any thoughts on whats gone wrong?
Thanks.
Dispelling Confusion
Just thought I'd clarify what my experience is. Before installing laravel 4 I could access all my projects with localhost/someProjectName
but now it fails.
I'm trying to identify what change caused this behaviour. Btw, I have no problems accessing my laravel project (my mapping allows me access to it via laravel.dev
)
I don't know if you're running L4 or L3. However, launch CLI and
Then for L4:
For L3:
Now you can go to
localhost:8000
and see your application.It sounds to me like it is a problem with the way your directories are configured. Be sure to create a Virtual Host (if you're using Apache) that points to the public folder within your application directory.
For example, if your Laravel project is under /Applications/XAMPP/htdocs/Laravel then set up a Virtual Host like this:
Additionaly, if you're working with PHP >= 5.4, SSH into the application folder and run
(Be sure that your PHP executable is in your PATH variable). Then go localhost:8000 and you should have your application running. Running this command runs the PHP built-in webserver and saves you the trouble of configuring virtual hosts.
In your Apache's http.conf, find the
DocumentRoot
line and add the subdirectory/public
on the end.Once that is done and you've restarted Apache, you'll be able to access everything which is contained within your
htdocs/public
folder (including subdirectories of that folder), along with any routes you've defined in Laravel.Laravel is designed to be set up this way as to protect the code and files by not having them in the folder which is served out to the web.
I have same issue and found that there are miss configuration in vhost. So that's are correct configuration.
in
etc/extra/httpd-vhosts.conf
In the hosts file
You're having problem because the object really doesn't exist in your
htdocs
directory. You don't have to appendxampp
afterlocalhost
or127.0.0.1
becausexampp
will treat it as an object or a folder underhtdocs
.if you want to access your blog, make sure you have a blog folder under
htdocs
and put in your URLlocalhost/blog
Look into your
/etc/httpd.conf
file and see if you have Virtual hosts activated.If so, check your
etc/extra/httpd-vhosts.conf
file. You might have set up a VirtualHost already.EDIT: I have found that once you turn on Virtual Hosts, XAMPP needs a default VirtualHost for your basic htdocs files
Try adding a default VirtualHost (at the bottom of the file) like so: