Difference between POST and the end slash in the URL.

Source: Internet
Author: User

Difference between POST and the end slash in the URL.

When debugging an interface, the php file name is index. php, which is placed under the directory/checkmail.


The url for access is/checkmail, and the post method of JQuery is used for calling.


It was found that the passed parameters were not passed during the call.


After tracking all the passed parameters, we found that $ _ SERVER ['request _ method'] obtained is GET.


It is clearly called by POST. Why is GET obtained?


Baidu did not find the answer.


Then various attempts were made. Finally, the backslash/was added in the called url, and the parameter was obtained.


That is to say,/checkmail and/checkmail/are different.


Continue to Baidu, and find that there is more to SEO with no slash added.


When the Web server receives a url request that does not contain a slash at the end, for example. When the Web server receives a request with a slash at the end, the request is processed directly as a directory.

Simply put, when the browser parses a url such as/checkmail, the server will execute 301 to/checkmail/. Both links are valid, but the second method is faster. Of course, this shift time is generally invisible and can be ignored. For search engines, these two addresses may be included at the same time.


That is to say, when using/checkmail/for access, because there is no checkmail file, it is switched to the/checkmail/directory, and the homepage of/checkmail/, that is, index. php, is called.

Because of the redirection, the POST data may not be switched to/checkmail/in POST mode due to server configuration /.


This should be the problem. Check whether the server configuration is correct or not.

It is clear that, if there is a difference between POST calling/checkmail/AND/checkmail, it is better to unify it into a unique URL.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.