1

Hi everyone I need a solution with laravel project when I try open backend admin with /control its giving me an error "Not Found - The requested resource /control was not found on this server."

When I change the name "/control" to anything like "/control5" or something its working fine but the problem is I use /control at views and other! I am new to laravel I didn't know what the problem was? please help me out with this!

Web.php

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

Route::get('/', [App\Http\Controllers\HomePageController::class,'index']);
Route::get('/listing', [App\Http\Controllers\ListingPageController::class,'index']);
Route::get('/details', [App\Http\Controllers\DetailsPageController::class,'index']);
Route::group(['prefix' => 'control','middleware' => 'auth'],function(){
   Route::get('/', [App\Http\Controllers\Control\DashboardController::class,'index'])->name('control');
   //Pages
   Route::get('/pages', [App\Http\Controllers\Control\PagesController::class,'index']);
   Route::get('/pages/add', [App\Http\Controllers\Control\PagesController::class,'create']);
   Route::get('/pages/edit', [App\Http\Controllers\Control\PagesController::class,'edit']);
});

DashboardController

namespace App\Http\Controllers\Control;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class DashboardController extends Controller
{
    public function index(){
        return view('control.dashboard');
    }
}
  • I don't see any resource route in your web.php , maybe you forget to create. – Mudit Gulgulia Nov 24 '20 at 16:11
  • its prefix /control – Watch-Online.in Nov 24 '20 at 16:12
  • the first one is for homepage and second one is for backend http://127.0.0.1:8000/ and http://127.0.0.1:8000/control – Watch-Online.in Nov 24 '20 at 16:14
  • Can you share your route list , generated with `php artisan route:list` ? – Mudit Gulgulia Nov 24 '20 at 16:16
  • @sta i have a resources/views/control – Watch-Online.in Nov 24 '20 at 16:20
  • @MuditGulgulia GET|HEAD| / | App\Http\Controllers\HomePageController@index | web GET|HEAD| about | App\Http\Controllers\AboutController@about | web GET|HEAD| control | control | App\Http\Controllers\Control\DashboardController@index | web auth GET|HEAD| control/genres | App\Http\Controllers\Control\GenresController@index | web auth GET|HEAD| control/genres/create | App\Http\Controllers\Control\GenresController@create | web auth DELETE| control/genres/delete/{id} | genres-delete | App\Http\Controllers\Control\GenresController@destroy | web auth – Watch-Online.in Nov 24 '20 at 16:23

1 Answers1

5

Because, you have a folder named control on /public folder. That error occurs when you create a folder in the public folder with the same name as your route so please change the name of the folder you have put in the public folder so that it has a different name from your route this will probably solve your error

STA
  • 30,729
  • 8
  • 45
  • 59
  • oh yes that was the issue! is there any way that i change its without change the name beacuse i had use that name for style and script in all views – Watch-Online.in Nov 24 '20 at 16:26
  • @Watch-Online.in I am not sure but may be htaccess can help https://stackoverflow.com/a/19118529/4575350 or try this one on your public root `.htaccess` file https://stackoverflow.com/a/51825743/4575350 – STA Nov 24 '20 at 16:30
  • 1
    thanks u bro! for that help I had search all around for this! :) – Watch-Online.in Nov 24 '20 at 16:32