Anyname Donotcare
Anyname Donotcare

Reputation: 11413

a tilda in a URL

Q: The first time i see an URL contains (~) ,i imagined .. what the (~) may point to in a real URL??

Upvotes: 1

Views: 1723

Answers (3)

cdhowie
cdhowie

Reputation: 169183

The ~ symbol is perhaps most commonly used by Apache's mod_userdir. It allows local users on the same machine running the web server to expose a subdirectory of their home directory to the web via Apache. For example, given the URL http://www.example.com/~joeuser, an Apache server might look up joeuser's home directory (usually /home/joeuser) and append another path component to it (usually public_html, resulting in the path /home/joeuser/public_html). This directory will then map to the /~joeuser URI.

It's become common to use URIs like this in more modern MVC-based web applications to refer to a user's profile. For example, /~joeuser might display the profile of the joeuser user in some web application. The meaning comes from the Apache-style URIs -- you are going to that user's "home page," whatever that might be.

Upvotes: 5

Tedd Hansen
Tedd Hansen

Reputation: 12316

In a real URL ~ is just like any other letter.

In some programming and in Unix shells ~ means "home directory". ~/ could reference the root directory of the website or the home directory of current user.

Specify more details, possibly with a sample, if you need more info. :)

Upvotes: 1

BoltClock
BoltClock

Reputation: 724222

Since you tagged this :

In certain ASP.NET URLs, for instance the NavigateUrl property of some web controls, the tilde represents the root directory of your ASP.NET web application. The following HyperLink control points to the root Default.aspx page of an ASP.NET site.

<asp:HyperLink runat="server" NavigateUrl="~/Default.aspx">Home</asp:HyperLink>

Upvotes: 9

Related Questions