HTML url

HTML url

Should I end my URLs with a slash?

View Answers

November 2, 2010 at 5:33 PM

The URL structure defines a hierarchy similar to a filesystem's hierarchy of subdirectories or folders. The segments of a URL are separated by slash characters ("/"). When navigating the URL hierarchy, the final segment of the URL (i.e., everything after the final slash) is similar to a file in a filesystem. The other segments of the URL are similar to the subdirectories and folders in a filesystem.

When resolving relative URLs (see the answer to the previous question), the browser's first step is to strip everything after the last slash in the URL of the current document. If the current document's URL ends with a slash, then the final segment (the "file") of the URL is null. If you remove the final slash, then the final segment of the URL is no longer null; it is whatever follows the final remaining slash in the URL. Removing the slash changes the URL; the modified URL refers to a different document and relative URLs will resolve differently.

For example, the final segment of the URL http://www.mywebsite.com/faq/html/ is empty; there is nothing after the final slash. In this document, the relative URL all.html resolves to http://www.mywebsite.com/faq/html/all.html (an existing document). If the final slash is omitted, then the final segment of the modified URL http://www.mywebsite.com/faq/html is "html". In this (nonexistent) document, the relative URL all.html would resolve to http://www.mywebsite.com/faq/all.html (another nonexistent document).

When they receive a request that is missing its final slash, web servers cannot ignore the missing slash and just send the document anyway. Doing so would break any relative URLs in the document. Normally, servers are configured to send a redirection message when they receive such a request. In response to the redirection message, the browser requests the correct URL, and then the server sends the requested document. (By the way, the browser does not and cannot correct the URL on its own; only the server can determine whether the URL is missing its final slash.)

This error-correction process means that URLs without their final slash will still work. However, this process wastes time and network resources. If you include the final slash when it is appropriate, then browsers won't need to send a second request to the server.

The exception is when you refer to a URL with just a hostname (e.g., http://www.mywebsite.com). In this case, the browser will assume that you want the main index ("/") from the server, and you do not have to include the final slash. However, many regard it as good style to include it anyway.









Related Tutorials/Questions & Answers:
HTML url
HTML url  Should I end my URLs with a slash
ModuleNotFoundError: No module named 'odoo10-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo10-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo10-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-html-image-url
Advertisements
ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-html-image-url
ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-html-image-url
ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo11-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-html-image-url
ModuleNotFoundError: No module named 'odoo12-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo12-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo12-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-html-image-url
ModuleNotFoundError: No module named 'odoo12-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo12-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo12-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-html-image-url
ModuleNotFoundError: No module named 'odoo8-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo8-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo8-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-html-image-url
ModuleNotFoundError: No module named 'odoo9-addon-html-image-url-extractor'
ModuleNotFoundError: No module named 'odoo9-addon-html-image-url-extractor...: ModuleNotFoundError: No module named 'odoo9-addon-html-image-url-extractor' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-html-image-url
call json object using url and represent in html tabular form
call json object using url and represent in html tabular form  how to call json object using url from html and represent in proper format it gives Json object after that i want to arrange the keys-values in table
call json object using url and represent in html tabular form
call json object using url and represent in html tabular form  how to call json object using url from html and represent in proper format it gives Json object after that i want to arrange the keys-values in table
HTML
HTML  What is Semantic HTML? What are the reasons for validating a HTML
HTML
HTML  What is Semantic HTML? What are the reasons for validating a HTML
HTML
HTML  What is SPAN in HTML
HTML
HTML  What is HTML? What is a Hypertext link
HTML
HTML  What is HTML? What is a Hypertext link
Html
Html  What is HTML? What is a Hypertext link
HTML
HTML  What is BODY in HTML document
html
html  diffrence between html and xml
html
html  How to add the calendar in html code
html
add a header in the html page  what we can do to add a header in the html page
HTML
HTML  How do we specify page breaks in HTML
HTML
HTML  What is a tag? How can we use MARQUEE in HTML
html
html  how to convert html page into jsp page
html
html  i want a registration page in html with good background
HTML
HTML  how can we give the unlimited size in the html
html
html  what we can do to add a header in the html page
html
html  what we can do to add a header in the html page
HTML
HTML  Hi, What is the full form of HTML? Thanks (adsbygoogle = window.adsbygoogle || []).push({});   Hi, The HTML stands for HyperText Markup Language. HTML is used to create webpage for world wide web
html
html  sir i am new to eclipse and i am created a html program and also tomcat is running successfully in side the eclipse.but now how i deploy that html program in the eclipse
html
html  Can we Access database through html page and how,if not then why
HTML
HTML  How do we create a link? What are the three types of form tags in HTML
html
html  how we can give the form actions in html after register button in the login page
html
Adding Header in HTML  what we can do to add a header in the html page
html
html  For what is used HTML?   Using HTML we can create a Web Page which can be viewed through a Web Browser over Internet. HTML describes... or the End Tag is defined as </> . The whole HTML document is enclosed
Html
Html  in the web page if judge select the age and category then automatically under that conditions the details will be display in the form of grid give me that code in html and java
html
html   write a html program to print "HELLO WORD"in red coaler font size 12 and italic stile   Here is a html code that display the message "Hello World" in red font with size 12 and in italics. <html> <
Html
Html  i am select the dateofbirth through the html browser.but it can not save into the sql server 2008 database.any special code required to store the date in database by using java servlets
HTML
HTML  I have created an info.html file for the applet.The class file is located in a directory different from the HTML file.The info.html file I have created is below. <HTML> <HEAD> <BODY> <APPLET Code
HTML
HTML  in html how can we can upload the file <tr> <td><strong>Video of the work:</strong> <td><b>... the file give me the code for this in html and java
HTML
HTML  how can we design the gird form view in html i want the following fields in the grid form The fields are Name of the candidate,Title... me the coding for this in html
html
html  Create a web page with the following using HTML i) To embed an image map in a web page ii) To fix the hot spots iii) Show all the related information when the hot spots are clicked.please reply me sir
Html
Html  I was designing a webpage, i need to create selection boxes one beside other, how i'll be able to do it using HTML code, Please give me a sample code for that... looking forward for your usefull code
Html
:48:44 PM Author : SAMSUNG --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...; <head> <meta http-equiv="Content-Type" content="text/html
Html
:48:44 PM Author : SAMSUNG --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...; <head> <meta http-equiv="Content-Type" content="text/html
HTML
in HTML is used to send the data as part of the URL. The get method is used... URL.    HTML get Method The HTML get...HTML      
HTML
where i can store in the database SEND ME THE CODE FOR THIS IN JAVA AND HTML
Html
Html  in html form for the address by using input as textarea i am writing the code as <tr> <td valign="top"><strong>Address: </strong></td> <td><textarea name="Address" rows="8
html
html   HTML document with Javascript to count the number of vowels in a text typed in text area. please send the code.   Hi Ravi Here... HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD>
Html
Html  can we send data from one html page to another html page? if yes how?   Yes, using javascript. 1)page1.html: <html> <form type=get action="page2.html"> <table> <tr> <td>First Name

Ads