Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Set AllowOverride all

I want to set the AllowOverride all But I don't know how to do it. I have found the following code by searching the google and pasted it in .htaccess:

<Directory>
        AllowOverride All
</Directory>

But after pasting it I started receiving "Internal Server Error"

Can anyone guide me where to put this code or how to do it?

like image 788
Munib Avatar asked Sep 25 '22 20:09

Munib


People also ask

What is AllowOverride all?

Apache has an option called “AllowOverride” which allows you to override some Apache settings via a . htaccess file you can place in a directory. In it, you can override PHP settings, create URL rewrites, … Pretty much the basics for every website.

What does AllowOverride none mean?

None disables all . htaccess files and directives. This directive is inheritable. This means if you specify AllowOverride none for some directory or virtual host . htaccess files will also be disabled for all subdirectories.

What does the AllowOverride directive do?

AllowOverride directive is used to allow the use of . htaccess within the web server to allow overriding of the Apache config on a per directory basis.


1 Answers

In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf (here we have an example of /var/www):

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

and change it to;

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

then,

sudo service apache2 restart

You may need to also do sudo a2enmod rewrite to enable module rewrite.

like image 378
Naveed Avatar answered Oct 22 '22 21:10

Naveed