A project, which is prepared with Laravel Framework, has handed over to me. Previous developer has not used git, some composer commands and Laravel’s .gitignore file(also removed it). On the other hand he has prepared the project on the production server.
Anyway. Firstly I’ve found a gitignore for laravel and pushed the project to my repository. Then I wanted to pull it to my local. All folders and files pulled except of vendor folder.
Then I executed:
composer install
Gave me this error:
Class 'MaatwebsiteExcelExcel' not found
Then I fixed it by the method here.
Then retried composer install
, gave me this error:
Undefined index: name
Then fixed it by the method here.
Then retried composer install
, and succeeded. Then I cleared cache with php artisan cache:clear
I’ve configured .env
file and tried to enter to homepage. It redirected me to login page and gave 404. I’ve checked the .htaccess, there was redirection like that:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ http://example.com/app/$1 [R=301,L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
<IfModule mime_module>
AddType application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
Changed the example.com to my localhost. But still gives me 404.
Is there anything that I’m missing?
Note: Called the previous developer, and he said me "directly copy and paste the all folders". Hi from 90s 🙁
3
Answers
Have you tried to generate you laravel application key using
php artisan key:generate
.If that also doesn’t work then try to remove
.htaccess
temporary.Try this command
OP Said this worked for him so I’m moving it from comments to an answer:
Let’s go over what should be there for the pages to return correctly: First you need a routes folder with with all the routes in files inside of it. Second you need the Controller folder (found in /app/Http). Third you need the resources folder with the actual views. Fourth you need the public folder with the CSS/JS, etc.
Since OP stated that all the views work except for the login view:
First find out what the login view page is called, then go to your routes and make sure there’s a line such as
Then go to the controller that is referenced in that route, and make sure that the function returns the view of the login page