0

I'm trying to lunch a Laravel app. My server IP address is 192.168.1.250. After installing Laravel I tried to acess it by typing 192.168.1.250/vls. VLS is my app name in /var/www/html directory. It showed directory listing. After some search the anser in this page How to stop laravel directory browsing said that I should create a .htaccess file in the root of my app, it means vls directory, and put the following code in it:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Now it shows an exceptional:

Sorry, the page you are looking for could not be found.
(1/1) NotFoundHttpException
in RouteCollection.php (line 179)
.....

And this is the only thing I have in /routs/web.php file:

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

What is wrong with it? I have not changed anything in Laravel. By the way it works fine when I use php artisan serve --host 192.168.1.250 and I can access my app by 192.168.1.250:8000.

EDIT: I added these lines to routs/web.php now it returns Hello.

Route::get('/vls', function () {
    return 'Hello';
});

It seems that Laravel considers /vls as a route parameter.

Beginner
  • 1,010
  • 4
  • 20
  • 42

0 Answers0