4

I'm getting kinda crazy over here because I already wasted two hours getting my clean URLs enabled for the laravel framework.

I'm on a Mac and have a XAMPP setup. The Loadmodule mod_rewrite is commented out and php_info() says mod_rewrite module is loaded.

My .htaccess file in the public folder of the laravel framework contains the code for cleans URLs (as stated on their website) but still, when I surf domain.com/account it gives me a 404.

The laravel framework folder runs as a virtual host.

What could it be, that is going wrong?!

<IfModule mod_rewrite.c>
     RewriteEngine on

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

     RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Rashed Hasan
  • 3,721
  • 11
  • 40
  • 82
Boyd
  • 723
  • 4
  • 15
  • 32
  • Remove the IfModule tags. If you do that, and mod_rewrite is not enabled you would get a 500 error. Adding the RewriteBase like Concordus describes below is also a good idea. – Gerben Jun 29 '12 at 19:50

1 Answers1

9

Make sure Loadmodule mod_rewrite is uncommented.

Make sure you have AllowOverride set appropriately for the vhost to allow .htaccess to do its thing.

One example of a good directive is:

<Directory "/some/absolute/path/htdocs">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory> 

A good patter to follow for .htaccess for what you are trying to do is:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Very close to what you are doing.

Restart your apache server.