Integrate Laravel 5 Apache in linux


Good I am trying to integrate laravel and apache but the routes are not recognized by the Apache.

Well I show the configuration that I have

in the virtutalHost of apache2 I have

<VirtualHost *:80>

  #Alias /loginseg /var/www/html/otro/laravel/public
  DocumentRoot "/var/www/html/otro/laravel/public"
  <Directory "/var/www/html/otro/laravel/public">
        AllowOverride All
        Order allow,deny
        Allow from all
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

and in the .htaccess of the project public is

<IfModule mod_rewrite.c>
Options +FollowSysmLinks
RewriteEngine On
RewriteBase /

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Authorization Headers
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]

the main page works perfectly but when I enter a different route to the index, the Not Found error is generated

Update Alfin is solved with what Xerif indicated with the a2enmod rewrite

Related resources link

asked by FuriosoJack 20.05.2017 в 22:50

1 answer


For laravel to work properly you must activate the rewrite module of url in apache (mod_rewrite).

To do so, you can use the following command:

sudo a2enmod rewrite 

Then you must restart apache.

sudo service apache2 restart
answered by 22.05.2017 / 10:36