Skip to content

Instantly share code, notes, and snippets.

Last active February 25, 2019 12:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rohankhudedev/d12dd17019ce0156ff01295f6c5e74d8 to your computer and use it in GitHub Desktop.
host laravel in server without manipulating structure and without artisan
  • 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

If only home page is showing properly and other pages are not working, then follow below steps

Lets say your project is under folder /var/www/html/ and call it as root folder of your project

  1. Enable rewrite mode in server and restart server $ service httpd restart
  2. 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 "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

Note: If you dont do this step then you cant access other pages of laravel. For example,

  • - Accessible
  • - Not accessible. Then you can access this page by

Hence, to fix this issue, we need this step.

  1. Restart the server $ service httpd restart


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment