The difference between the post and the trailing slash in the URL

Source: Internet
Author: User

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


The URL at the time of the visit is written in/checkmail, which is called by the jquery post method.


Start to discover that the parameters passed in when checked are not passed.


Trace all the arguments passed, and found that $_server[' Request_method ' got to be get.


When it is called by post, why get it?


First Baidu a bit, did not find the answer.


So a variety of attempts, and finally in the URL of the call, the backslash/plus, found that the parameters are obtained.


In other words,/checkmail and/checkmail/are not the same.


Continue to Baidu, found that the discussion plus no slash, in the SEO more.


When the Web server receives a URL request that does not have a slash at the end, such as "Http://www.abc.com/checkmail", then the server searches for a file named "Checkmail" in the root directory of the Web site. If not, treat Checkmail as a directory and return to the default home page in the Checkmail directory. When the Web server receives a request with a slash at the end, it is treated directly as a directory.

In a nutshell, when the browser parses a URL such as/checkmail, the server performs 301 turns to/checkmail/and two links are valid, but the second one is faster. Of course, the time of the steering is generally not felt, can almost be ignored. For a search engine, these two addresses are likely to be included at the same time.


That is, when/checkmail/access, because there is no checkmail this file, so was turned to/checkmail/directory, and/checkmail/home, that is, index.php is called.

Because of being turned around, the data that comes in post may not be turned to/checkmail/by post because of server configuration reasons.


This should be the problem, as to whether the server configuration or how to match, no longer look.

It is more clear that post calls/checkmail/and/checkmail, if there is a difference, or unified into a unique URL is better.

The difference between the post and the trailing slash in the 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.