Mail data is not being received at the target URL

I had a scenario where the form data at needs to be published on another site:

Now when data was being sent and then sent or received a 200 status code, I was getting 301 status codes for a permanent redirect and therefore no data was being sent.

Checking the target url I changed it from to , yes, I only added a forward slash after / myfolder and there I got a successful response.

I need some help understanding how to simply add a forward slash at the end of the target URL so that my data is successfully submitted?

Note : the destination web page was a subdomain of the original web page


source to share

3 answers

I need some help understanding how to simply add a forward slash at the end of the target URL so that my data is successfully submitted?

This is because myfolder

the target site is a real directory . Apache has a module called mod_dir

responsible for this behavior due to security reasons.

  • Whenever a request comes in for a real directory without a trailing slash then mod_dir

    redirects to the same URI plus a trailing slash using a 301 status code.
  • After 301 redirects, POST data is lost.
  • When you used

    POST for data then mod_dir

    did not hit the image as your URI already has a trailing slash, hence no redirection and no loss of POST data.

This behavior can be changed using:

DirectorySlash Off


But it is considered a potential security risk because it can show the contents of directories.



Since search engines can be quite tricky when it comes to duplicate content issues on different versions of the URLs of the same page that are considered duplicate, many webmasters make any directory page with a trailing slash .

Now any directory without the slash anchor gets redirected to the slash version and you will probably find that index.html, index.php, etc. are also redirected to the trailing slash.

However, this means that there is a policy on the server (such as with a .htaccess rule) that forces a 301 redirect and POST stops working.

Below are the answers showing how the recipient succeeded.



@anubhava introduced it while I was typing and his explanation is correct. I can add more details:

It depends on your server settings. In particular, it is DirectorySlash. I had a learning curve with this about 2 years ago while trying to POST with an API endpoint I created.

If you do not put a forward slash at the end of your folder name, the server may assume that the folder you are referring to is actually a file (whether it physically exists or not). This is why it does not try to access any "index" file within it and why the query fails. The DirectorySlash parameter tells Apache to add a slash to the end of the URL if it is not a file (no extension), and in doing so, it will try to find the index file inside it.

An additional setting called DirectoryIndex can be used to specify the types of "index" files that you want to find.

In cases where an incorrect redirect is issued to add a forward slash, the _POST data can be lost - most often when mod_rewrite is used in .htaccess and you didn't tell it to redirect correctly.

In short, unless your server is prompted to automatically add a slash to the end of a URL, it is most often treated as a file without an extension.

Here's a link to Apache settings and more information:



All Articles