Charges well with the laravel server but does not load with xampp


I'm doing some routes in Laravel when I load these routes with the Laravel server works well for me

Answer me the return of the driver that is 'good night'

the route is


and the view:

Route::get('/' , function(){

    return view('app');


class ProductController extends Controller

    public function index()
        return 'buenas noches';


In app this:

    <div class="container">

        <a href="{{ route('products.index') }}">info</a>

    <script src="{{ asset('js/app.js') }}" ></script>

but when I use it with xampp:

Show me:


Sorry, the page you are looking for could not be found.

asked by William T 08.04.2018 в 07:28

2 answers


I'll tell you a couple of things about your code.

  • If you already have a resource controller, which will control the request to show that specific view through the index method; The only thing you should have in your code is:
  • The routes.js file

    Route::resource('/products', 'ProductoController');

    On your controller, where hello is the name of the view but you can put the one you want

    public function index() 
            return view('hola');

    And finally the URL that you should work on your XAMPP is the following



    Unless you have configured a specific server, your URL must be composed of:

  • localhost = > Well, point to a resource from your own PC
  • tests = > this is the name of the whole project, replace it with the one you put in yours
  • public = > there is the frontend controller then processes the requests that arrive at the Framework
  • products = > is the URL that I declared as an access point in my routes.php file

    Unless you explain to us what use you give, the following fragment of code I see it more; that is, I should not go

    Route::get('/' , function(){
        return view('app');


    If for any reason that view you are trying to return does not have dynamic content, that is, interacting with BD, you can avoid the controller part and use the utility from Laravel 5.6; as follows


    Where you first place the URL that must respond and second the name of   the view you are going to invoke; but EYE is only for content views   static

    answered by 08.04.2018 / 14:54

    The problem is that the laravel server starts running from the public folder, which when trying to access the root, it does so in public/ and in xampp, the root in htdocs the solution is to create a local domain that points to

  • Go to file C:\Windows\System32\drivers\etc\host
  • Add your host to the end of the file like
  • Save the file, you will need administrator permission. I recommend editing it with notepad ++
  • Now go to file C:\xampp\apache\conf\extra\httpd-vhosts.conf
  • Edit the file and direct your host to your project folder

    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot "C:\xampp\htdocs\laravel\tienda1\public"
        ErrorLog "logs/"
        CustomLog "logs/" common
  • this should work with

    answered by 08.04.2018 в 17:43