Simply viewing Laravel in browser using Xampp Server, no php artisan serve

Last updated on October 30th, 2020 at 04:16 pm.

You have just installed laravel in Xampp or Wamp. I will use Xampp to illustrate. You need to view the Xampp installation without firing up the server on cmd that is, >>php artisan serve.

To view the Laravel installation on the browser using Xampp server you would normally have to type localhost/examplelaravel/public in most cases you don’t want to type ‘public’ all the time. In this short post I will show you how to get it to localhost/examplelaravel. You will be able to view your site without the public in the url

  1. Go into the laravel files folder then into public. Eg if you installed laravel in examplelaravel, you should go into the folder examplelaravel/public then locate index.php and copy the file to the root of your site laravel files, ie paste it in examplelaravel.
  2. Then open examplelaravel /index.php in an editor of your choice.
  3. Go to line 21 and change it to as follows
require __DIR__.'/bootstrap/autoload.php';
  1. Go to line 35 and change it  as follows
$app = require_once __DIR__.'/bootstrap/start.php';
 
  1. You should now be able to visit localhost/examplelaravel and your site will load.

Needless to say, this tutorial is intended for use in your development environment just to make your work easier if you prefer to use Xampp or Wamp.

Update 2018: 

It’s been three years since I used Laravel. If this doesn’t work anymore, my apologies. Let me know in the comments. Right now I am more involved with Server Management, Digital Marketing Tools, Front End Web Technologies, JS and JS Frameworks . Hence I have no plan to review PHP or Laravel anytime soon.

If it doesn’t work and you find a solution, paste it in the comments and I will update the post and credit it to you.

Comment Here

Need WordPress help? Linux Server help? Talk to us.

  • We are your own WordPress customer service.
  • We set up Linux servers and install or migrate WordPress. Learn more here.
  • We support WooCommerce too.
  • Check out our WordPress customer support plans here or contact us below .

If you have any questions regarding WordPress support, Linux server support or any of our services, feel free to reach out or read more on our services page.

Join this free course:

How to host multiple WordPress
websites on a VPS

Close me!