- Before cloning project on server run below command. ref
$ umask 0022
- Then clone your project
- Run composer update ```$ composer update`
- Give required permissions
$ chmod 0777 -R storage/
$ chmod 0777 -R bootstrap/cache
$ php artisan storage:link
- Now create
.htaccess
and add below code
RewriteEngine on
#RewriteCond %{HTTP_HOST} ^sub\.domain\.com$
#RewriteCond %{REQUEST_URI} !^/public
#RewriteRule ^(.*)$ /public/$1 [L]
RewriteRule ^(.*)?$ ./public/$1
- Done. Enjoy
Lets say your project is under folder /var/www/html/
and call it as root folder of your project
- Enable rewrite mode in server and restart server
$ service httpd restart
- Find and edit
httpd.conf
may be at/etc/httpd/conf/httpd.conf
. Find below code and change it to
<Directory "/var/www">
AllowOverride All
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Note: If you dont do this step then you cant access other pages of laravel. For example,
- domain.com/ - Accessible
- domain.com/other_pages - Not accessible. Then you can access this page by domain.com/index.php/other_pages
Hence, to fix this issue, we need this step.
- Restart the server
$ service httpd restart