0

I'm trying to limit access to .php files through HTTP, allow only to index.php.

I should allow access to .php files only through POST and require.

I did the following:

    location ~ ^((?!index\.php).)*$ {   
        allow 127.0.0.1
        deny all;
    }

This blocks all files except index.php, however it blocks also POST queries..

Any ideas?

1 Answer 1

0

Locations apply to all requests types. Unfortunately the only way I can think to do this is using IF

location ~ ^((?!index\.php).)*$ {   
  if ($request_method = GET ) {
    allow 127.0.0.1
      deny all;
  }
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .