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?

Tim
  • 30,383
  • 6
  • 47
  • 77
Leeloo
  • 103
  • 2

1 Answers1

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;
  }
}
Tim
  • 30,383
  • 6
  • 47
  • 77