How can I disable mod_security in .htaccess file?

后端 未结 7 1665
盖世英雄少女心
盖世英雄少女心 2020-12-02 22:42

How can we disable mod_security by using .htaccess file on Apache server?

I am using WordPress on my personal domain and posting a post whi

7条回答
  •  孤城傲影
    2020-12-02 23:18

    Just to update this question for mod_security 2.7.0+ - they turned off the ability to mitigate modsec via htaccess unless you compile it with the --enable-htaccess-config flag. Most hosts do not use this compiler option since it allows too lax security. Instead, vhosts in httpd.conf are your go-to option for controlling modsec.

    Even if you do compile modsec with htaccess mitigation, there are less directives available. SecRuleEngine can no longer be used there for example. Here is a list that is available to use by default in htaccess if allowed (keep in mind a host may further limit this list with AllowOverride):

        - SecAction
        - SecRule
    
        - SecRuleRemoveByMsg
        - SecRuleRemoveByTag
        - SecRuleRemoveById
    
        - SecRuleUpdateActionById
        - SecRuleUpdateTargetById
        - SecRuleUpdateTargetByTag
        - SecRuleUpdateTargetByMsg
    

    More info on the official modsec wiki

    As an additional note for 2.x users: the IfModule should now look for mod_security2.c instead of the older mod_security.c

提交回复
热议问题