简体   繁体   中英

400 Bad Request on Apache/PHP AddHandler wrapper

I'm trying to create a wrapper/handler that will be called on the Apache server whenever someone requests any PHP script inside of a directory. That way I can authorize users for the entire directory or write some other stuff to be called when the directory is called.

This is the best configuration I've been able to come up with...

 <Directory "/srv/http/INNOV/PUBLIC_HTML">
  Options -Indexes
  AllowOverride All
  Order allow,deny
  Allow from all

  DirectoryIndex index.php
 </Directory>

Then in /srv/http/INNOV/PUBLIC_HTML/kb/ I have this .htaccess file...

Options -Indexes

AddHandler auth_handler .php
Action auth_handler ../auth_handler.php

Then in /srv/http/INNOV/PUBLIC_HTML/kb/auth_handler.php is as follows...

<?php
$FILE = $_SERVER['PATH_TRANSLATED'];
echo $FILE;
?>

Access Log:

  - - [02/Dec/2010:17:43:15 -0500] "GET /kb/index.php HTTP/1.1" 400 590

Error Log:

[Thu Dec 02 17:50:19 2010] [error] [client XXX.XXX.XXX.XXX] Invalid URI in request GET /kb/ HTTP/1.1

I've checked my browser and it seems to be making a proper request.

nvm, all I had to do was remove the ../ in the htaccess file. DUR! Apologies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM