Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hawkiq's avatar

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

This like the first time i face such a problem, I use Laravel for quite time , I faced this problem when Upgraded to Laravel 8, I've created new project did my work as usual uploaded to shared hosting then i got this error The GET method is not supported for this route. Supported methods: HEAD. this error appears only in root URL "/" any other routes works fine. here is an example https://osama.app/masarat show an error but this URL https://osama.app/masarat/index , works as required so what is wrong with "/" URL

route file 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('/', [App\Http\Controllers\PagesController::class, 'index'])->name('index');
Route::get('/index', [App\Http\Controllers\PagesController::class, 'index'])->name('index2');
Auth::routes();

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

its works OK on local server

0 likes
15 replies
hawkiq's avatar

am sorry I forgot to attach route file with the post

<?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('/', [App\Http\Controllers\PagesController::class, 'index'])->name('index');
Route::get('/index', [App\Http\Controllers\PagesController::class, 'index'])->name('index2');
Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Sinnbeck's avatar

I keep seeing this error pop up, but never with a solution. Any chance your code is on github so I can test it myself?

hawkiq's avatar

its just fresh new app, works fine on local server, but problem occurs on shared hosting only with "/" route

Sinnbeck's avatar

You can try defining rewrite base in you htaccess and see if that help

Not sure about shared hosting so try one of these

RewriteBase /
//or
RewriteBase /masarat/
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

My best guess is that the error comes because it appends a / to the route. The one that works does not

Is it inside a folder with that name?

Sinnbeck's avatar

Could you try adding this to your htaccess and see if the page works then?

DirectorySlash Off
hawkiq's avatar

I think this maybe kinda true , because i have another Laravel project on root of my public_html folder so I think they are somehow interfere with it, i will try to make it as subdomain and see if this still happen

hawkiq's avatar

I made it as subdomain and its works fine, thanks for the help

hawkiq's avatar

Yup i have same situation, i just made it as subdomain and works perfectly

venkateshmani's avatar

After Running this artisan command solved the issue for me php artisan clear-compiled

1 like

Please or to participate in this conversation.