eignhpants
eignhpants

Reputation: 1771

Laravel won't route except home directory

I have a fresh install with almost no changes and it will not accept any new routes. I have tried multiple things with the virtual hosts file, mostly what I found on other sites but nothing has worked.

I am able to get the default, but no other routes.

So this works:

Route::get('/', function()
{
    return View::make('hello');
});

but this doesn't:

Route::get('test', function()
{
    return 'Hello;
});

Right now I have a conf file for apache that looks like:

<VirtualHost *:80>

#Host Name
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias www.example.com
DocumentRoot /path/to/our/public

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /path/to/our/public>
    <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
</Directory>

</VirtualHost>

I have no problem accessing the site, it loads and I get the welcome page from laravel but I can't do any other routing or anything. Permissions are all okay and I can change this route to anything I want.

Upvotes: 0

Views: 3151

Answers (2)

Mahezer Carvalho
Mahezer Carvalho

Reputation: 95

I was able to get it working by changing the AllowOverride on the rules for the /var/www in my /etc/apache2/apache2.conf file.

Original:

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride none
  Require all granted
</Directory>

New:

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

Upvotes: 3

eignhpants
eignhpants

Reputation: 1771

I was able to fix the error by following topics in the comments from my question.

Most expeccially this link on the ReWrite engine property in the .haccess file and this linke regarding changing the httpd.conf file (apache2.conf on my Apaache/Ubuntu system).

Upvotes: 1

Related Questions