Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu 12.04 AllowOverride All throws Internal Server Error

I just created my server and I need to use .htaccess files, one of them worked and another one didn't... Apparently for .htaccess to work you need to enable AllowOverride, and so I did under: /etc/apache2/sites-available/default Changed this:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

To this:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

When I restart apache my whole site now throws error 500 Internal Server Error

My .htaccess file contains this:

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

Anyone has any idea why?

like image 445
Shepard Avatar asked Sep 06 '14 21:09

Shepard


1 Answers

Your apache config seems fine to me.

You get 500 Internal Server Error which means your htaccess is now executed.
If you didn't enable mod_rewrite you get such errors.

Should be working as expected once mod_rewrite enabled.
Also, don't forget to add a RewriteBase (which will prevent future problems with virtual directories)

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
like image 102
Justin Iurman Avatar answered Sep 18 '22 18:09

Justin Iurman