0

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 !

ratm
  • 913
  • 1
  • 11
  • 20

5 Answers5

0

may be try: http://localhost/adhesion/adherer or http://localhost/adherer i hope it helps you.

Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
0

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.

rmondesilva
  • 1,732
  • 3
  • 17
  • 29
0

Change your url to this, Remove public

/adhesion/adherer

From

/adhesion/public/adherer
Niklesh Raut
  • 34,013
  • 16
  • 75
  • 109
0

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

Community
  • 1
  • 1
ratm
  • 913
  • 1
  • 11
  • 20
0

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>
m0z4rt
  • 1,055
  • 2
  • 17
  • 25