0

I have mod_rewrite enabled on Apache2 and AllowOverride All in the default file. However Apache (After restarting) still can't seem to redirect when given a pretty url from Laravel.

WORKS (Returns: Users!): localhost/laratest/public/index.php/users

DOESN'T WORK (404): localhost/laratest/public/users

My .htaccess: (I've also tried the one suggested in the Documentation to no avail)

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Laravel routes.php:

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

Route::get('users', function()
{
    return 'Users!';
});

I am using the default LAMP stack and configuration in Ubuntu. Any ideas why this isn't working?

Blenderer
  • 682
  • 1
  • 5
  • 17
  • possible duplicate of [Laravel 4 .htaccess Not Rewriting URLs](http://stackoverflow.com/questions/16912134/laravel-4-htaccess-not-rewriting-urls) – Blenderer Sep 03 '13 at 18:56
  • Solution in: http://stackoverflow.com/questions/16912134/laravel-4-htaccess-not-rewriting-urls – Blenderer Sep 04 '13 at 18:12

2 Answers2

1

Have you set your RewriteBase to /laratest/public?

Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteBase /laratest/public
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Mike Rockétt
  • 8,947
  • 4
  • 45
  • 81
0

As suggested on the laravel website (http://laravel.com/docs/installation#pretty-urls) try this other one:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
ehp
  • 1,689
  • 3
  • 14
  • 20