I'm running a website with Laravel 9. All my routes are mapping correctly, but one of them ("https://example.com/resources") inexplicably keeps adding "/public/" to the page's URL (e.g. "https://example.com/public/resources").
The page runs fine, but I obviously don't want "/public" in there.
All the pages with child URLs work without the "public" directory (e.g. "https://example.com/resources/locations"). I can't figure out why "public" keeps getting added to the "/resources" URL and only to that one.
I have run php artisan route:list with the following result:
GET|HEAD / ............................................................................................................ home
POST _ignition/execute-solution .......... ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController
GET|HEAD _ignition/health-check ...................... ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController
POST _ignition/update-config ................... ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController
GET|HEAD api/user .............................................................................. generated::aJrGF7dIWENf1Kwl
GET|HEAD company ................................................................................................... company
GET|HEAD contact ................................................................................................... contact
GET|HEAD contact/careers ................................................................................... contact-careers
GET|HEAD contact/expert ..................................................................................... contact-expert
GET|HEAD contact/quote ....................................................................................... contact-quote
GET|HEAD contact/survey ..................................................................................... contact-survey
GET|HEAD contact/technical ............................................................................... contact-technical
GET|HEAD contact/thank-you ................................................................................ contact-thankyou
GET|HEAD industries ....................................................................................... industries-index
GET|HEAD products ........................................................................................... products-index
GET|HEAD products/ilh ......................................................................................... products-ilh
GET|HEAD products/ils ......................................................................................... products-ils
GET|HEAD products/ilt ......................................................................................... products-ilt
GET|HEAD products/iltr ....................................................................................... products-iltr
GET|HEAD projects ........................................................................................... projects-index
GET|HEAD resources ......................................................................................... resources-index
GET|HEAD resources/cv ......................................................................................... resources-cv
GET|HEAD resources/locations ........................................................................... resources-locations
GET|HEAD resources/login ................................................................................... resources-login
GET|HEAD resources/privacy ............................................................................... resources-privacy
POST resources/process ........................................... resources-process › ResourcesController@resourcesForm
GET|HEAD resources/terms ................................................................................... resources-terms
GET|HEAD resources/terms-detail ..................................................................... resources-terms-detail
POST resources/terms/process .......................................... terms-process › ResourcesController@termsProcess
GET|HEAD resources/warranties ......................................................................... resources-warranties
GET|HEAD sanctum/csrf-cookie ............................. sanctum.csrf-cookie › Laravel\Sanctum › CsrfCookieController@show
GET|HEAD services ................................................................................................. services
Here is the group code from my web.php file:
Route::group(['prefix' => 'resources'], function() {
Route::get('/', function() {
return view('resources.index');
})->name('resources-index');
Route::get('locations', function() {
return view('resources.locations');
})->name('resources-locations');
...
}
My webserver is Apache v2.4.29 (Ubuntu)
The routing works fine locally using php artisan serve. It is only on the server where this is occurring.
From what I can determine, my folder is the same name as the "resources" folder in Laravel. So even though it's a specified View, Laravel defaults to add "/public" to specify the difference.