I have just installed fresh laravel 5.1, only root page is showing that
Route::get('/', function () {
return view('welcome');
});
It's working perfectly but rather than any other route not working
like:
Route::get('user', function () {
return "hello";
});
It throws exception 404 not found. Please help me to get out from this. Thanks in advance.
It may be because of rewrite mode is not enabled in your system. Either you enable it or access through the following url with index.php
http://localhost/blog/public/index.php/user
Related
I've been laraveling for 5 months now but I reformatted ubuntu and installed Laravel, this time, it's Laravel 7 instead of Laravel 6. My problem is simple routing giving an error. It's so dead simple you might think I'm a stupid beginner.
In my Web.php
Route::get('/about', function () {
return view('welcome');
});
Route::get('/', function () {
return view('welcome');
});
I also tried using a controller that returns a view and just a simple "string" in Web.php
Route::get('/about', 'UserController#index');
Typing http://localhost/about in the address bar in chrome causes 404 error.
As you can see, there should be no problem returning the same view('welcome'), even if I return a simple return "TEST";, results are the same.
I tried downgrading to Laravel 6 by deleting vendor, changing the Laravel v6 in composer.json and running composer install but still the same, so I think it's not the version.
This has never happened to me before even when I first started with Laravel 6 five months ago and it's a totally fresh project.
enable rewrite_mode of Apache server and restart Apache server it will solve the issue.
Run server with php artisan serve
and then try http://localhost:8000/about hope it will fix your problem
OR
Simply use http://localhost/project/about
I have just installed laravel 5.7. So, In web.php I have defined Route.. Like
Route::get('foo', function () {
return 'Hello World';
});
But when i Hit the URL -> http://localhost/rp/public/foo
It shows me 404 page not found.
use PHP's built-in development server, you may use the serve Artisan command:php artisan serve
Later you can check in browser like this: http://localhost:8000/foo
If you have to check without artisan serve
Route::get('/foo', function () {
return 'Hello World';
});
you can check like this(rp is your laravel-project-name): http://localhost/rp/public/foo
you must have a configuration like this in your .htaccess file
My laravel project is showing this error: NotFoundHttpException in RouteCollection.php when i am trying to sync my project to github using github desktop, except for this route:
Route::get('/', function () {
return view('welcome');
});
but another simple route like following will not work, and return that error.
Route::get('loa', function () {
return view('loa');
});
In route list, using route command: php artisan route:list it says it exists. but it always returns Route not found. I also have tried to use the command dump-auto load or route:clear, but nothing is working.
Run composer update then try again.
Please, help me to find what is going on.
I just set up a basic Laravel project. It's a new fresh Laravel project (5.2.29)
This is route.php
Route::get('/', 'TestController#index');
This is the test controller
class TestController extends Controller
{
public function index()
{
return view('home');
}
}
The home.blade.php is the one that comes with a fresh Laravel installation, the one printing "Laravel 5".
When I add the 'web' middleware, as following
Route::group(['middleware' => ['web']], function () {
Route::get('/', 'TestController#index');
});
I get this error: "Maximum function nesting level of '100' reached, aborting!".
I read some thread about xDebug, so i add this line to xdebug.ini
xdebug.max_nesting_level = 1000
but nothing changed.
Any help? Or any suggestion on what else could I check?
Thank you
Try to remove web middleware, because now it applies automatically to all routes. So, since v5.2.27 you do not need to apply web middleware to avoid errors.
If you installed new application (5.2.27 at the moment of installation), you don't have to use web middleware group because it will be automatically applied, however if you installed version prior to 5.2.27 and then updated to 5.2.27 or later you still need to use it.
So first you need to verify app/Providers/RouteServiceProvider.php if there's web middleware group automatically applied. If yes, you should remove it from routes.php because you might get unexpected behaviour.
If it's not the case, you should verify what Middleware are included into web middleware group because some of them might cause problems
I Started One New Project in Laravel. After Installed and Updated the Composer. I Run My Project. Home Page is Display. I create and goto Login Page of my Project It. Display
Not Found The requested URL /emr/login was not found on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80
How do Solve It.
Code in controllers
class AuthController extends BaseController {
public function __construct() {
$this->beforeFilter('auth', array('only'=>array('dashboard')));
}
public function userlog() {
return View::make('login',array('metatitle' => 'Register'));
}
}
route file :
Route::get('/', function()
{
return View::make('login');
});
Route::get('login','AuthController#userlog');
First of all, you should point your web server (Apache, for example) to the public directory of your Laravel project.
Then use this route:
Route::get('emr/login','AuthController#userlog');
Or go to /login in your browser.
You're using /emr/login path, but you do not have right route for it, that's because it doesn't work.
Route::get('/login', 'AuthController#userlog');