Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP won't receive POST requests at /directory/ only at /directory/index.php

Tags:

php

When POST request are sent to "http://domain.com/directory/", the POST data isn't received. But if it's sent to "http://domain.com/directory/index.php" it is received.

How can I make it work when just the directory is called? Thanks!

like image 389
James Skidmore Avatar asked May 22 '10 23:05

James Skidmore


3 Answers

If you're running Apache, check if the mod_dir module is enabled and configured correctly. These are the contents of my dir.conf:

<IfModule mod_dir.c>
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
like image 116
Elbert Alias Avatar answered Nov 11 '22 18:11

Elbert Alias


Have you tried using a tool like HttpFox for Firefox to see if when you make a request to the directory on its own, you are being redirected? I know a redirect can kill a POST request as it gets converted into a GET request.

like image 38
Geoff Adams Avatar answered Nov 11 '22 18:11

Geoff Adams


As Lucanos said, is the web server redirecting to index.php? POST data might get "lost" between pages if you redirect. Try GET and check if the URL ends with correct data.

like image 37
Propeng Avatar answered Nov 11 '22 17:11

Propeng