#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0

    Exclamation PHP POST Header is not working on sub domain :(


    Greetings,
    Hope all active user is fine on this forum.

    i am a facing a wired issue..
    On my sub-domain i have php script, that works fine till few days ago.. but now it is not working..

    It use _POST data, i submit post data but it don't getting any post data.

    So, for testing i am using this code:
    Code:
    <?php
    if (isset($_POST['Code']))
    {
    	echo 'set';
    }
    else
    {
    	echo 'not set';
    }
    echo '<br>';
    exit ('911');
    ?>
    and here is the HTML form for testing:
    Code:
    <form method = "POST" action = "http://MySubDomain.MyDomain.com/chk.php" name="Test">
    	<input name="Code" value="varData"/>
    	<p align="center"><input type="submit" value="Send Request To Server !"/> </p>	
    </form>
    but it's not working above php code returns:
    Code:
    not set
    911
    but if i run that same php file from my base domain and submit the request it works fine and returns:
    Code:
    set
    911
    i m in so danger.. and that subdomain process a import script for my site. and now it is now working while it was working fine few days ago..

    so, any help would be highly appreciated

    thanks in advance for any upcoming help

    best regards
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,247
    Rep Power
    9400
    Is there any kind of redirection happening with the subdomain?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0
    Originally Posted by requinix
    Is there any kind of redirection happening with the subdomain?

    thanks a lot for your reply..

    1st. sir, i didn't change anything on my server (on my sub domain)

    but yes in .htaccess i have code to redirect my sub domain to my base domain.

    for example
    if any one type this url in his browser:
    Code:
    www.MySubDomain.MyBaseDomain.com
    then he will be redirected to :
    Code:
    www.MyBaseDomain.com
    i do that redirection because that sub domain is for only processing PHP script nothing to interact with user directly..

    hope i m clear..

    sir, is that causing the issue?

    please sir, leave a reply asap ..

    once again thanks a lot for you reply

    and will be waiting for your kind reply

    best regards
  6. #4
  7. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,247
    Rep Power
    9400
    Yes, that's the problem. You cannot redirect a POST request with all the data in tact. The form has to point directly to the right location.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0

    Exclamation


    Originally Posted by requinix
    Yes, that's the problem. You cannot redirect a POST request with all the data in tact. The form has to point directly to the right location.
    but sir, i m not redirecting that request. that request call is direct ink to the php file on sub domain

    and also it was works few days ago.. then why not now?

    thanks again for your reply

    best regards
  10. #6
  11. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,247
    Rep Power
    9400
    You said you're redirecting MySubDomain.MyBaseDomain to just MyBaseDomain, right? And that the form is using MySubDomain.MyBaseDomain?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0
    Originally Posted by requinix
    You said you're redirecting MySubDomain.MyBaseDomain to just MyBaseDomain, right? And that the form is using MySubDomain.MyBaseDomain?
    yes...

    but the form use fully path like:

    Code:
    http://www.MySubDomain.MyBaseDomain/chk.php
    will that redirect too?

    thanks again for your help/reply..

    best regards
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0
    Originally Posted by requinix
    You said you're redirecting MySubDomain.MyBaseDomain to just MyBaseDomain, right? And that the form is using MySubDomain.MyBaseDomain?
    dear sir,
    after i use this code

    Code:
    var_dump($_REQUEST);
    it returns with following value: (on sub domain)

    Code:
    array(1) { ["_ga"]=> string(25) "1.2.1267118956.1368643472" }
    and return following on my base domain:

    Code:
    array(1) { ["Code"]=> string(7) "varData" }
    any help would be highly appreciated ..

    once again thaks a lot for your help/reply

    best regards
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0

    Exclamation


    Originally Posted by requinix
    You said you're redirecting MySubDomain.MyBaseDomain to just MyBaseDomain, right? And that the form is using MySubDomain.MyBaseDomain?
    sir, i am very sorry, but may be i am wrong..

    after some checking it seems my sub domain does not have any redirection::

    this is my .htaccess file contents:

    Code:
    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5 .php
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^(www.)?MyDoamin.com$ [NC]
        RewriteCond %{REQUEST_URI} ^/SubDomain/(.*)$
        RewriteRule ^(.*)$ - [L,R=404]
    so, i don't think it is redirecting..

    please check and confirm..

    best regads
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,016
    Rep Power
    376
    why dont YOU check and confirm? go to your subdomain.maindomain.com and see if it redirects?
    then go to that script ubdomain.maindomain.com/process.php or whatever its called directly into the browser and see if it still redirects?
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0

    Exclamation


    Originally Posted by paulh1983
    why dont YOU check and confirm? go to your subdomain.maindomain.com and see if it redirects?
    then go to that script ubdomain.maindomain.com/process.php or whatever its called directly into the browser and see if it still redirects?
    dear sir, thanks for your reply

    however, please check my previous message..

    i told i was wrong, and nope it (my sub domain not redirects

    thanks again for your reply

    best regards
  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0

    Question


    any help please?
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    29
    Rep Power
    0
    at last i have found the issue..

    it's not in my sub domain .htaccess file..

    it is in my base domain .htaccess file.
    my my base domain .htaccess file, i have rule, if url visited without www then it will redirect/add www.

    so, for example:
    Code:
    http://mydomain.com
    will be redirect to
    Code:
    http://www.mydomain.com
    and that's the culprit

    now i add www to my sub domain and it working nice

    thanks sir, paulh1983 and specially sir, requinix for their replies..

    now how can i mark this thread as resolved?

    best regards

IMN logo majestic logo threadwatch logo seochat tools logo