.htaccess File ignored now what?

July 22, 2015 / General Discussion

.htaccess file ignored

Summary:

It may be that you are trying to use an .htaccess file on your Dedicate Server to do URL rewriting, authentication, management, handling error pages, etc. Except that at the time you perform the tests, you notice that nothing happens. Then you certainly start thinking now what…

In fact, this is due to the configuration of your website in Apache and particularly the value assigned to “AllowOverride”. Which stipulates that default does not take into account the type of files in .htaccess.

Explanation:

Let’s take a closer look at the parameter “AllowOverride” to see the different values that can be attributed to the cause of the issue and what it means. We will check the possible values with an explanation for each of them.

1-“None”: By default implies that .htaccess files ignored for the entire website.

2-“AuthConfig”: It is a value that specifies the authorization of permissions guidelines, more precisely authentication (AuthName, AuthType, etc…)…

3-“FileInfo”: a value that allows the use of documents and module control directives such as the ErrorDocument directive for the error message personalization and a URL rewritten with “URLRewrite”.

4-“Indexes”: Value that allows the use of guidelines for the indexing of files. Such as to define a “DirectoryIndex” or alternative index.

5-“Limit”: Value that allows the use of guidelines for server access restrictions, namely Allow, Deny, and Order.

6-“All”: Value that allows the use of all instructions.

Note: You can combine multiple values to allow only the types of directives that you want.

Now we will see the Modification part:

Now we have taken knowledge of the different values that can be assigned to the “AllowOverride”. Now we can change the configuration of Apache on our website. In case you use the default Apache site (which is the case if you have only one site on your server), the file to edit is:

/etc/apache2/sites-available/default

Next,

AllowOverride None Apache

In the configuration directory “/var/www/” that corresponds to the root of our website, we note the presence of “AllowOverride None” therefore means, I do not know .htaccess or more precisely ‘ignores all the guidelines contained in .htaccess files’.

Change the value assigned to the parameter with one (or more) value indicated above. For example:

AllowOverride All Apache

Restart Apache Service:

After the setting, it will just need to restart Apache served so that it takes into account the changes. Then you can your files .htaccess!

Service apache2 restart