I had a scenario in which a data on form in http://www.omsite.com to be posted on other website say http://www.hissite.com/myfolder
Now whenever the data was being posted, rather then getting posted or getting Status Code 200 I was getting 301 Status code for permanent redirect and hence data was not getting posted.
Checking the destination URL I changed it from http://www.hissite.com/myfolder to http://www.hissite.com/myfolder/, yes, I added only a slash after /myfolder and there I got the successful response.
i need some help in understanding how just adding a forward slash at the end of destination URL made my data to get posted successfully?
Note: Destination webpage was the subdomain of source webpage
i need some help in understanding how just adding a forward slash at the end of destination URL made my data to get posted successfully?
That is happening because myfolder
on the destination site is a real directory. There is module called mod_dir
in Apache responsible for this behavior due to security reasons.
mod_dir
redirects to same URI plus a trailing slash using 301 status code.http://www.hissite.com/myfolder/
to POST data then mod_dir
didn't come into picture since your URI already has a trailing slash hence no redirect and no loss of POST data.This behavior can be changed using:
DirectorySlash Off
But it is considered a potential security risk as it might reveal directory content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With