Debug School

rakesh kumar
rakesh kumar

Posted on • Updated on

Laravel:The GET method is not supported for route /. Supported methods: HEAD.

Error:The GET method is not supported for route /. Supported methods: HEAD

Image description

MY code in web.php

<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

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

Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Enter fullscreen mode Exit fullscreen mode

Solution

Verify server side url is working or not
Enter fullscreen mode Exit fullscreen mode

add in web.php

Route::get('wz-organisation-ms', [WelComeController::class, 'index'])->name('index');
Enter fullscreen mode Exit fullscreen mode

Full code

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\WelComeController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Route::get('/', function () {
    return view('welcome');
});

Route::get('wz-organisation-ms', [WelComeController::class, 'index'])->name('index');
Enter fullscreen mode Exit fullscreen mode

In WelComeController

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class WelComeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */


    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        log::info("aata hai naa");
        return view('welcome');
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)