Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess for clean urls not being read by apache?

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>
like image 797
Boyd Avatar asked Jan 17 '23 06:01

Boyd


1 Answers

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.

like image 69
Concordus Applications Avatar answered Jan 28 '23 12:01

Concordus Applications