0

if we omit the / from the end of href address in <a> tag, then whats happening to the requests ?

Hello Masters. i n this tag : <a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a> W3schools Says: Note: Without a forward slash at the end of subfolder addresses, you might generate two requests to the server. Many servers will automatically add a forward slash to the end of the address, and then create a new request. --------------------------------------------------------------------------------- so we send 2 requests to the server and why w3schools say: Many servers will automatically add a forward slash to the end of the address, and then create a new request!!! I'm confused that the Client get 2 requests or the server gets 2 requests? and the additional request originates from server to client ? or originate from client to the server? Thank You.

4th Aug 2019, 6:37 PM
Patient Learner
Patient Learner - avatar
2 Antworten
+ 2
Patient Learner you answered your own question in the details of your question... potential double request to the server..... generally nothing will return as the hyperlink is looking for closure and the rest of the page might act like one huge button... if it can find a closing tag...
4th Aug 2019, 8:31 PM
BroFar
BroFar - avatar
+ 1
Thank You. in Stackoverflow they answer in details if anyone interested in it then sees below: Stackoverflow Answer By (deceze♦): A web server receiving a request for /foo may look at it and see that its foo is actually a folder, and decide that the actual address for this folder is /foo/. So it will respond with a 302 redirect to the client and tell it to fetch /foo/ instead: browser to server: GET /foo server to browser: 302 Found, Location: /foo/ browser to server: GET /foo/ server to browser: 200 OK, content... Whether the server does this or not depends on your server. Ultimately you should always use the actual URL of items in your links, don't rely on a server to "fix it" implicitly for you.
5th Aug 2019, 3:19 PM
Patient Learner
Patient Learner - avatar