Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 .htaccess Not Rewriting URLs

So I've just upgraded to Laravel 4, and I'm setting things up on a new server. The default / route works fine, but every other route returns a 404 error. When trying index.php/route, I get the requested data, so that means that .htaccess isn't working.

Yes, AllowOverride is set to ALL.
Yes, I enabled the mod_rewrite module.

I have tried the following 3 .htaccess combinations:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

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

and:

<IfModule mod_rewrite.c>
   RewriteEngine on

   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d

   RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

and:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

And, after a server restart, and so on, none of them are working, and I'm still returning a 404 error.

Note: I am using several domains with the same laravel install, so my public folders are public/site1, public/site2, public/site3. However, I am routing the public paths to these folders, so I'm not sure that would be the problem.

Any thoughts?

like image 338
Dalton Gore Avatar asked Jun 04 '13 07:06

Dalton Gore


1 Answers

I forgot to edit the vhosts in httpd.conf. Derp, derp. Added:

<Directory "/var/www/public/site1">
    AllowOverride All
</Directory>

to each of the site's vhost files, and it worked beautifully. Derp derp.

like image 180
Dalton Gore Avatar answered Sep 22 '22 12:09

Dalton Gore