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
- Use withCount() to Calculate Child Relationship Records
- Show old value while editing the form in Laravel
- How to get records in random order in laravel
- Get duplicate records in laravel
- How to get route name on visit URL in laravel
- Display data in table using foreach in Laravel
- How to use more than one query scope in Laravel
- Laravel hasmany select not working
- How to generate .env file for laravel?
- How to show data by ID in laravel?
- How to get list of all views file in laravel
- Laravel delete all rows older than 30 days
- Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()
- How to get column names from table in Laravel
- How to check data inserted or deleted in pivot after toggle method
- Update if exist else insert new record in laravel
- Pagination in laravel
- Composer\Exception\NoSslException
- How to create pivot table in laravel using migration
- Target class [HomeController] does not exist
- If condition in Laravel 9
- Print last executed query in laravel
- Symlink(): No such file or directory
- Get only 10 records from table in laravel
- Cannot end a section without first starting one