Apache 2.2.x AllowOverride can i use it in negative way?

Discussion in 'Apache' started by postcd, Sep 24, 2017.

  1. #1
    Hello,

    i assume that on the Apache 2.2 server when someone want to run perl/python script, he add this line to the .htaccess:
    AddHandler cgi-script .cgi .pl

    I would like to prevent Apache following this .htaccess directive/rule. My aim is that by default all .htaccess can not set handler for .cgi .pl .py

    I thought that on Apache 2.2.x, i can use AllowOverride directive in global httpd.conf to somehow achieve that, but i am unsure how that directive should look like to work.

    Here i am quoting related answers from other similar topic:

    (this is what i have just done)

    Above things are meant for Litespeed, so i do not know if can work.

    PS: Apache 2.4 is claimed to support "AllowOverrideList"

    Current Apache global config file:
     
    Last edited: Sep 24, 2017
    postcd, Sep 24, 2017 IP
  2. hostechsupport

    hostechsupport Well-Known Member

    Messages:
    413
    Likes Received:
    23
    Best Answers:
    7
    Trophy Points:
    138
    #2
    Hello postcd,
    >> In your main apache config file, add the directive AllowOverride None.

    This will prevent it from looking at .htaccess files directives.

    For more info, see http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

    Example: <Directory ...>
    AllowOverride all
    to
    <Directory ...>
    AllowOverride none

    Hope this helps you:)
     
    hostechsupport, Oct 26, 2017 IP