0
votes

In the file routes.php

when i have :

Route::get('/', ['uses' => 'AdhererController@show']);

it works with url http://localhost/adhesion/public/

but when i have

Route::get('/adherer', ['uses' => 'AdhererController@show']);

or Route::get('adherer', ['uses' => 'AdhererController@show']);

it doesn't works with urls

The error is :

Not Found

The requested URL /adhesion/public/adherer was not found on this server. Apache/2.4.7 (Ubuntu) Server at localhost Port 80

What's wrong ?

Thanks in adavance for any helps !

5
try only adherer insted of /adherer - Nikhil Vaghela
same error with adherer .. - ratm
Seems like you misunderstand the sense of routing. - rmondesilva
how you are creating this url ? - Niklesh Raut
localhost/adhesion is created with php artisan but i have created localhost/adhesion/public/adherer myself - ratm

5 Answers

0
votes

Routing:

When you have a route like this, /adherer

Route::get('/adherer', ['uses' => 'AdhererController@show']);

You will access this through this URL

example.com/adherer or in your case, http://localhost/adherer

NOT

http://localhost/adhesion/public/adherer

Everything you put in your route starts from your base url.

0
votes

Change your url to this, Remove public

/adhesion/adherer

From

/adhesion/public/adherer
0
votes

It is a problem relative to apache configuration with laravel :

The requested URL /ProjectName/users was not found on this server. Laravel

Apache DocumentRoot must point to 'RoadToProjectName/ProjectName/public'

Afer that

Route::get ( '/adhesion/adherer', [
        'as' => 'ctrl_adherer',
        'uses' => 'AdhererController@show' 
] );

works with url http://localhost/adhesion/adherer

0
votes

In file: .env, modify APP_URL to:

APP_URL=..

Try this:

Route::get('adherer', 'AdhererController@show');

Test: http://localhost/adhesion/public/adherer

By the way, you could create apache config to resolve your issues:

Alias /your_project /var/www/html/your_project/public/
<Directory "/var/www/html/your_project/public">
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>