How to upload local Laravel project to server ?
To upload the laravel local project to server you have to first check the node_modules directory and dist directory in public folder and vendor directory exist or not. Before uploading files to server check the all important files (node_modules, vendor, public/dist, vendor/autoload.php) which is required to run application properly.
If thery are not available then please run composer install
command to generate the vendor folder, npm install
and npm run build
to generate the node_modules and public/dist folder and also run composer dump-autoload
if autoload.php file is not available in vendor directory.
Create database on server and import data from local development environment.
Compress local laravel project to zip file and upload to server (public_html)
Make changes for database and others configuration details to your .env file
APP_URL=http://domain.com
DB_DATABASE=database_name
DB_USERNAME=database_username
DB_PASSWORD=database_password
Create a .htaccess file on project root directory and place below code in it.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization MemberHeader
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]
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Now you can visit you website. Hope it works for you.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- How to update record after save method in Laravel
- How to remove package from laravel
- How to insert ckeditor data into database in Laravel?
- How to run a specific seeder class in laravel
- Laravel specific table Migration
- SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist
- Create project factory and seed data in laravel
- How to create controller in laravel
- Php artisan make model, factory, migration and controller in single command
- How to insert multiple rows in mysql using loop in laravel?
- How to decrypt laravel password
- Trying to get property 'title' of non-object
- Retain selected value of select box in Laravel
- Convert multidimensional array to single array in Laravel
- Check if Relationship Method Exists in Laravel
- How to send email in Laravel 11
- Laravel migration add foreign key to existing table
- Return view from route Laravel
- Sample .htaccess file and index.php file under public directory in laravel
- Display data in table using foreach in Laravel
- How to get only time from created_at in laravel
- Convert input array to comma-separated string in laravel controller
- Post model with title and body in laravel 8
- How to get data from two tables in laravel
- Update if exist else insert new record in laravel