I just cloned a Laravel/Vue.js project from Bitbucket (for a company I’m working with), trying to set it up on my computer. This isn’t my first time doing this, as I’ve previously cloned and worked on many projects. But for this one, I can’t figure out the problem. I’ve run Composer, copied the .env file, generated a new key, and run all migrations. I’ve always used this process when cloning laravel projects – cloning laravel project from github.
When I try to load any of the pages (login, register, home, any page at all), it shows a 404-page not found.
To debug the problem, I tried to dismember it from the VueJs component by removing the app.js script from the home page so that it shows only the HTML document in the home.blade.php file, but it still didn’t work – so I’m sure the problem is not a VueJs problem.
I’ve checked the routes in the web.php file to make sure it’s hitting the right controllers, and it is. However, I noticed that although it hits the right controller, it doesn’t read any of the functions inside it. I know this because it doesn’t even throw an error when I change the function names. I’m attaching a list of the first few routes and the first few lines of the HomeController.php page.
Web.php
use IlluminateHttpRequest;
use IlluminateLogLogger;
use IlluminateSupportFacadesHash;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', 'HomeController@show');
HomeController.php
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return Response
*/
public function show()
{
//sensitive information removed
return view('home', array(
'user' => $user
));
}
}
2
Answers
I think your public folder doesn’t have the
.htaccess
if you didn’t find the .htaccess file, you can get your copy from here
https://github.com/laravel/laravel/blob/9.x/public/.htaccess
also you need to make sure that your web server (apache or nginx ..etc) enabled the mod_rewrite otherwise the URLs will not working
I hope it’s helpful
You need to add it as a
Route
.