Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hyperlink who's path is only a forward slash (/)

Tags:

html

hyperlink

I have been asked to make some changes to a friend's company website. It uses a PHP insert file for the header on each page, which is useful as the navigation etc is the same on every page.

The following code designates the company logo on every page:

<div id="logo"> 
    <a href="/"></a> 
</div>

As you can see, the href of the a tag contains only a forward slash / as it's path.

The link is working fine, and connects to the index.php page.

I'm wondering how it is doing this? Seeing as the default page for the domain is controlled by the server config file, is this a shortcut to link to whatever the default page is designated as?

I've never seen this done before, and I can't seem to find any documentation concerning it. I appreciate any information you can provide.

like image 706
stefmikhail Avatar asked Sep 30 '11 15:09

stefmikhail


People also ask

What happens when you save a hyperlink with two slashes?

When you save a hyperlink that contains two or more consecutive forward slashes (/) in Microsoft Word or Microsoft Outlook, the group of slashes is changed to a single forward slash. Therefore, the hyperlink is no longer valid. This article contains information about how to modify the registry.

What is a forward slash in a file path?

Yet, for a relative path, Windows adopts forward slashes. While in Mac, Linux, Android, Chrome, and Steam, all Unix-like operating systems, directories in file paths are separated by forward slashes. For instance, /System/Library/Screen Savers. Just as mentioned in the above content, the forward slash is usually called “slash” and is widely used.

What does the slash at the end of a URL mean?

The trailing slash matters for most URLs Conventionally, a trailing slash (/) at the end of a URL meant that the URL was a folder or directory. At the same time, a URL without a trailing slash at the end used to mean that the URL was a file. However, this isn’t how many websites are structured today.

Why do some URLs have multiple forward slashes in a row?

For example, URLs containing base64 encoded paths may explicitly require support for multiple forward slashes in a row, so browsers can’t just copy the web servers default behavior on this one.


1 Answers

That link brings you to the public root, and then the default file kicks in.

It's the relative equivalent of an absolute path, such as http://stackoverflow.com/

In Linux and other Unix-like operating systems, a forward slash is used to represent the root directory, which is the directory that is at the top of the directory hierarchy and that contains all other directories and files on the system. Thus every absolute path, which is the address of a filesystem object (e.g., file or directory) relative to the root directory, begins with a forward slash.

Forward slashes are also used in URLs (universal resource locators) to separate directories and files, because URLs are based on the UNIX directory structure. A major difference from the UNIX usage is that they begin with a scheme (e.g., http or ftp) rather than a root directory represented by a forward slash and that the scheme is followed directly by the sequence of a colon and two consecutive forward slashes to indicate the start of the directories and file portion of the URL.

via: http://www.linfo.org/forward_slash.html

like image 140
leifparker Avatar answered Oct 01 '22 17:10

leifparker