Internal Server Error with . htaccess Linux Mint file

Asked

Viewed 2,188 times

0

I’m getting an HTTP 500 error Internal Server Error on linux Mint, Apache server.

Server version: Apache/2.4.7 (Ubuntu) / Server built: Apr 3 2014 12:20:28

file . htaccess

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1

What is the solution?

1 answer

4


Module disabled

Probably your Apache2 does not have the Rewrite module enabled.

Typo ls /etc/apache2/mods-available/ | grep rewrite and check if it appears rewrite.load, if it appears it means that the rewrite module is already installed and just activate it, so type the following:

a2enmod rewrite # Ativar o módulo
service apache2 restart # Reiniciar o servidor

If you have not appeared a rewrite.load when you gave it ls /etc/apache2/mods-available/ | grep rewrite then mod_rewrite is not installed, look for how to install mod_rewrite on Linux Mint (probably the same way as Ubuntu)


Allowoverride

Now we have to talk to Apache2 to allow changes, through the Allowoverride. Navigate to the Apache2 website directory

cd /etc/apache2/sites-enabled/

typhoon ls and see which site you want to edit, probably will be the 000-default.conf. Leaving with the presupposition that this is the name:

mcedit 000-default.conf 

(replace mcedit with your favorite editor, like nano, gedit or geany). And edit all the Allowoverride to Allowoverride All if you don’t have any Allowoverride in 000-default.conf edit the file /etc/apache2/apache2.conf and look for something like this:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

And replace it this way:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Prevent . htaccess from giving error 500

You can prevent error 500 by changing your file. htaccess to only do the actions if the rewrite module is enabled, so change your file . htaccess so:

# Checar se o modulo esta ativado
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?url=$1
</IfModule>
  • Already existed the rewrite.load, activated it, followed the other steps, but still did not work...

  • Ah, I did, delete the line I had: Allowoverride Authconfig, and it all worked, thank you!!

  • This was for me to solve in Windows, thanks!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.