Jilco Tigchelaar
Jilco Tigchelaar

Reputation: 2187

Magento 2.2.2 error .htaccess IfVersion 2.4

In the default .htaccess in Magento 2.2.2 there are in 2 of the things like below:

<Files cron.php>
    <IfVersion < 2.4>
        order allow,deny
        deny from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all denied
    </IfVersion>
</Files>

There are someting about 20 of these for some files (eg. composer.json, composer.lock, .gitignore, etc)

When updating magento i gave a lot of errors, when i remove them out of the htaccess the problem was gone.

Wij are this versionchecks there, wat do the do and what can happen when i remove them?

Upvotes: 2

Views: 4186

Answers (3)

Yasir
Yasir

Reputation: 46

I faced the same problem on Centos(Cpanel) Apache 2.4. The issue was resolved by enabling the mod_version module for Apache.

Upvotes: 3

Chakravarthy Gopi
Chakravarthy Gopi

Reputation: 41

Earlier versions of Magento do not have support for Apache version >=2.4. I used to replace order allow,deny and deny from all lines with Require all denied in htaccess files manually to resolve the issue.

From the Magento 2.2.2 version, code is changed to support apache version >= 2.4 also. ( https://github.com/magento/magento2/pull/11459/files )

As per the info you have mentioned, I inferred that your Apache version is < 2.4 , rather than editing all 24 files, you can load mod_version.

You have to load version moudle from apache configuration file as below.

LoadModule version_module /usr/lib64/apache2/mod_version.so

otherwise you may get "Internal server error".

Upvotes: 1

Tejas Vyas
Tejas Vyas

Reputation: 121

This is apache versioning. You can get more details from the above GitHub link https://github.com/magento/magento2/issues/10810

These changes are made as per security prospect to improve the direct file access algorithm.

Upvotes: 0

Related Questions