Edgar Sampere
Edgar Sampere

Reputation: 273

Routes not working on server using Laravel 5.2

I'm deploying a webapp to a digitalOcean droplet and it displays the home route just fine. I have dependencies installed, Apache conf pointing to laravel's public folder, permissions given to www-data so Apache can use the folder but, when I try to access a link defined in the site, already defined in the routes file, for example /about I get a 404 error.
Why could this be?
The droplet's runs Ubuntu 16.04, I have Apache and php7.
I was reading this two posts: 1 and 2 but got no luck
My apache conf file is

<Directory /var/www/html/analizalabs/public>
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

My sites-available file

 ServerAdmin [email protected]
 DocumentRoot /var/www/html/analizalabs/public/
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

Part of my routes file

Route::get('/','PagesController@home');
Route::get('/about','PagesController@about');
Route::get('/contact','PagesController@contact');

My htaccess file

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

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

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Permissions like...

drwxrwxr-x   8 www-data dev   4096 Sep  9 21:58 public

where dev is the group I use to modify files with rw access in that directory.

Upvotes: 1

Views: 1274

Answers (1)

MoeinPorkamel
MoeinPorkamel

Reputation: 711

It seems rewrite module isn't enabled, You have to enable it using:

a2enmod rewrite

Note1: rewrite module is not enabled by default in ubuntu

Note2: You can check enabled modules with apache2ctl -M and apachectl -M in mac ( or httpd -M in both )

Upvotes: 3

Related Questions