Steps for Apache Web Server and Laravel in Linux Environment.
-
Open httpd.conf
sudo vim /etc/httpd/conf/httpd.conf # for debian users: /etc/apache2/apache2.conf
-
Make sure the DocumentRoot is pointing to the laravel project’s public directory
-
Add the Directory element for that path and Allowoverride All… as follows
DocumentRoot "/var/www/html/laravel/public/" <Directory "/var/www/html/laravel/public"> Allowoverride All </Directory>
-
Open .htaccess from ../laravel/public/ and make sure it has the following
<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>
-
Restart httpd services
sudo service httpd restart
-
Now
http://DomainServer/users
will work in your browser.