3

I'm trying to manually parse one page on my website with multipart form data sent from a Java application. All the pages are served inside the index file in the public_html directory, and my classes for my other pages rely heavily on $_POST data being populated.

I can parse the multipart data if I set:

php_value enable_post_data_reading Off

But then my other pages error out for un-populated $_POST data.

How can I turn off $_POST reading for this one page in my content directory and leave it on for all my other pages?

My VirtualHost is as follows (only works with the one page):

<VirtualHost *:80>
    ServerName elementbox.lampllc.com

    DocumentRoot /var/element.lampllc.com/public_html

    CustomLog     /var/element.lampllc.com/access.log combined
    ErrorLog      /var/element.lampllc.com/error.log
    LogLevel info
    /*THIS IS THE FIX*/
    <If "%{QUERY_STRING} == 'mod=APIlogin'">
        php_value enable_post_data_reading Off
    </If>

    <Directory "/var/element.lampllc.com/public_html/">
        AllowOverride All
        Require all granted
        Options -Indexes
    </Directory>

    RewriteEngine on
        RewriteRule ^/index/(.+)$       /index.php?mod=$1       [PT]
</VirtualHost>

I've tried specifying the file in question with

<Files "myfile">

I've tried making an alias for a directory and setting a Directory directive for it outside of my "mod" directory (where my content is) but I get rewrite errors.

UPDATED WITH ANSWER

0

Try using an If condition:

<If "%{SCRIPT_URI} == '/myfile.php'">
    php_value enable_post_data_reading Off
</If>
1
  • I tried alot of IF directives, this worked for me. I appreciate it as I hadn't considered the IF directive yet. <If "%{QUERY_STRING} == 'mod=APIlogin'"> php_value enable_post_data_reading Off </If> – Haskell McRavin Dec 25 '15 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.