2

I have two files as follows:

  • one.php
  • two.php

Code for one.php

<?php
header( 'Location: two.php' ) ;
?>

Code for two.php

<?php
echo 'Hello Two' ;
?>

I wish to implement the following:

  1. When a user access one.php using the http GET method, he/she should get a basic Auth prompt (401)
  2. When a user access one.php using the http POST method, he / she should get the 405 - Method Not Allowed.
  3. When a user access one.php using the http HEAD method, he / she should get the 302 Found.

I can implement the (1) and (2) with the help of .htaccess. However, since Apache consideres GET and HEAD as one, I am unable to implement (3). Is there any way I can implement the above scenario in Apache so that I can differentiate between GET and POST and configure .htaccess separately.

madm0nk
  • 63
  • 4
  • 1
    possible duplicate of [Find out HTTP method in PHP](http://stackoverflow.com/questions/1538065/find-out-http-method-in-php) – Biffen Nov 16 '14 at 14:32

0 Answers0