Home Answers Viewqa HTML HTML url

 
 


samar
HTML url
1 Answer(s)      2 years and 7 months ago
Posted in : HTML

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 Pages:
HTML url
HTML url  Should I end my URLs with a slash
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
problem with dynamic url
a dynamic url code below to a html template I designed. I am a web designer... it right. Can't figure out why there is a space in the path on the "$t_url..." ) #set ( $t_url = "$t_base$t_market
url capture in javaScript
url capture in javaScript  Hi All, I m creating a bookmark to capture the url of the site and the user's input in the bookmark,in javaScript.this url and user input is to be saved into DB. Following is my code.Result
Problem with url in oracle
Problem with url in oracle  hi i m having trouble with the following code. when i run it i get the error as invalid oracle url specified. i am using... language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding
HTML
HTML Get  method in HTML is used to send the data as part of the URL... be sent with a limited URL.    HTML get... HTML      
JavaScript Open URL
JavaScript Open URL...; In this section, you will learn how to open the url on the window.  As we know that window.location object that contains the current URL information
JavaScript Navigate to URL
JavaScript Navigate to URL... to the specified URL "http://www.roseindia.net". Here is the code... url will get open: Download Source Code:    
JSP Get URL
JSP Get URL          JSP Get URL is used to get the url of the current... ( ) that return the url of the current page. Understand with Example The Tutorial
JQuery url validation
jQuery url Validation : jQuery "required url" is the method to validate or check url if the element is empty (text input) or  wrong url type entered .We can validate our url in another type by writing the "url
Struts2.2.1 url Tag Example
Struts2.2.1 url Tag Example In this tutorial, We will discuss about the URL tag in struts2.2.1This tag is used.to to create an URL and output it as a text format. It?s never work by itself,but it can provides URL to other tags like <
Creating URL using <c:url>
from the html page. them. <p /> The generated URL is <c:out...Creating URL using <c:url>     ... then the container will automatically use the URL rewriting. In servlets while
post method does not support this url
. but I am receiving one error that is post method does not supported by this url...("text/html"); PrintWriter out=res.getWriter(); out.println("<
Java Servlet : Get URL Example
Java Servlet : Get URL Example In this tutorial, You will learn how to get url... the requested client URL. It returns the current URL which containing protocol... parameters. It returns URL in StringBuffer in place of String so if required you
PHP Variables from URL
PHP Variables from URL Are you facing problem passing PHP variable from URL... one thing if you are passing unnecessary information in the URL is fine but if you are passing confidential information like password or username in the URL
HTML get Method
HTML get Method       The HTML get Method is used to submit the data of the page as part of the URL. When the form data or query is submitted, the form data is appended
HTML Get Radio Button
in URL. Understand with Example The Tutorial illustrates an HTML Get Radio Button... HTML Get Radio Button       HTML Get  method in HTML is used to send the data as part
java html
{ String url="jdbc:mysql://localhost:3306/mobile"; Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection(url...-Type" content="text/html; charset=UTF-8"> <title>JSP Page<
<c: url> in JSTL
then the container will automatically use the URL rewriting. In servlets while the url... of the URL.  We can do the same thing by using the <c: url> core action tag. By using the <c: url> we are doing the URL rewriting but by using
URL Encoding and URL Decoding
URL Encoding and URL Decoding  What is URL Encoding and URL Decoding ?   URL encoding is the method of replacing all the spaces and other extra characters into their corresponding Hex Characters and Decoding
Img Tag<html:img>:
Img Tag<html:img>:       html:img Tag : Renders an HTML <img> element with the image at the specified URL. This tag allows dynamic generation of an image as  specified
How to Get Referer URL Servlet
How to Get Referer URL Servlet In this section we will discuss about getting the referer url in Java. This example explains you how to get the referer url in Servlet. This tutorial explains you all the steps of getting the referer url
Introduction to HTML
Introduction to HTML       Here, we will introduce you to the basics of HTML. HTML stands for Hyper Text Markup Language. Using HTML we can create a Web Page which can
HTML Post Radio Button
HTML Post Radio Button       HTML Post attribute used in method, when a user is not able to see the data in the URL of browser. Post method is used for sending, updating
HTML - base tag example.
HTML - base tag example. Description : The base tag is a HTML tag. It specifies a base(default) URL for all link in the page. Code : <html>...;title>HTML is a markup language</title> </head> <body>
Friendly URl
Friendly URl  creating a SEO friendly URL
HTML - Email example
HTML - Email example Description : There is not any specific tag for email in HTML. But with the help of HTML, we can easily add mail facility in our HTML page. HTML has a anchor tag with href attributes. The href attributes has
HTML - Image tag.
HTML - Image tag. Description : HTML supports two type tags. 1-Singular tag... and end tag. The img tags is used for embedding image in HTML page. There is an attribute in img tag called src, it  holds the URL of that image which you
HTML link code.
HTML link code. Description : It is also called hyper link. HTML provides... is a attributes of anchor tag. The holds the URL of that page or site, on which...;/a> Code : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
URL problem
URL problem  Hi. I have created a webpage for my project website. in that i have used frameset to split the page. Now if i click any link in the page its navigating to the another page. but the problem is here in the url its
hide url
hide url  how i can hide url i have lot of jsp pages when i call one jsp in address another jsp page name also displayed in the address bar? url not visible to endusers please tell me any answer what i should do
Assigning URL
url to my attendancetemplate.jsp file, please help me if anyone knows, am
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+css - Java Beginners
html+css   Cunningham... { margin: 0; padding: 0; background: url(images/main_bg.png) repeat; font-family... { width: 975px; margin: auto; } #header { background: url(images/bg.png
Introduction to HTML
Introduction to HTML       Here, we will introduce you to the basics of HTML. HTML stands for Hyper Text Markup Language. Using HTML we can create a Web Page which can
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+css - Java Beginners
html+css   Davgan Financial Services... { background: url(images/logo.gif); float:left; display: block; height: 58px...; } #nav { background: url(images/nav_bg.png) repeat-x; height:39px; margin
html login page with ajax
html login page with ajax  hi all... i want to create a login page using html and ajax for validation is must. please help me doing that with code...; var password = window.document.f1.password.value; var url = "check.jsp?username
html
add a header in the html page  what we can do to add a header in the html page
HTML
HTML  how can we give the unlimited size in the html
HTML
HTML  How do we specify page breaks in HTML
HTML
HTML  What is a tag? How can we use MARQUEE in HTML

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.