When running a project using Laravel Mix, I get a 404 and cannot access the pages. I did composer install I didn't create the project, it had a structure like this before.
main
-core
-app
-routes
-...
-index.php
-assets
I think they moved the public folder to a higher folder, so I created the public folder again and moved it there. require DIR.'/../vendor/autoload.php'; I made the paths as follows, then when I do php artisan serve it works but I get 404 and I can't access any page.
I can't reach the example route, it gives 404
Route::get('/test', function () {
return "test route!";
});
I went to console
Starting Laravel development server: http://127.0.0.1:8000
[Thu Feb 29 16:22:53 2024] PHP 7.4.33 Development Server (http://127.0.0.1:8000) started
[Thu Feb 29 16:23:00 2024] 127.0.0.1:49296 Accepted
[Thu Feb 29 16:23:01 2024] 127.0.0.1:49296 Closing
package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"postcss": "^8.1.14"
}
}
It works but I get 404 and I can't access the page.
I entered the install index.php in the directory as localhost/xxx/install/index.php and installed it and it was solved.