WWW

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • creating "tinyURL" for my website

    1 answers - 1366 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    I'm experimenting with creating a tinyURL type of service for use on my
    own website.
    I understand the mechanics of putting the URLs in a database and using
    a hash as a key into the database. The part I don't understand is how
    the URLs that are created by some of the services work.
    For example, what I have working so far using php creates URLs that
    look like this
    However, some of the free services that I'm emulating have much shorter
    URLs and I'm not sure how they work. Most of them somehow map what
    looks like a folder name to the database key. notlong.com somehow uses
    subdomains, and makeashorterlink.com uses what looks like http get
    parameters but there's no name=value, just a key after the question
    mark. See examples below
    metamark.net
    http://xrl.us/h6rq
    SnipURL
    http://snipurl.com/3aqv
    TinyURL
    http://tinyurl.com/cas9
    shorl.com
    notlong.com
    http://hipmolus.notlong.com
    Make a Shorter Link
    I'd like to create something where my URLs look like TinyURL and the
    others
    http://domain.com/abc123 but I don't understand the mechanism on the
    server that maps the folder abc123 to the database key. I can't
    imagine that there is really a file or folder called abc123.
    Can anyone help me out?
  • No.1 | | 2310 bytes | |

    William Krick (wkrick@gmail.com) wrote:
    : I'm experimenting with creating a tinyURL type of service for use on my
    : own website.

    : I understand the mechanics of putting the URLs in a database and using
    : a hash as a key into the database. The part I don't understand is how
    : the URLs that are created by some of the services work.

    : For example, what I have working so far using php creates URLs that
    : look like this

    :

    : However, some of the free services that I'm emulating have much shorter
    : URLs and I'm not sure how they work. Most of them somehow map what
    : looks like a folder name to the database key. notlong.com somehow uses
    : subdomains, and makeashorterlink.com uses what looks like http get
    : parameters but there's no name=value, just a key after the question
    : mark. See examples below

    Various things come into play.
    -1-
    The normal way a web server works is that a path may not exist, but a cgi
    script does exist with a shorter name, and so that script is run with the
    rest of the path as input (i.e. an environment variable, you'll have to
    look up the name)

    E.g. simple case
    exists and is a cgi script

    so you can use the following

    script.cgi is run, and "/more/path/info" is available as an input.

    If you configure the web server correctly then the script doesn't need to
    be in cgi-bin, and also doesn't need the .cgi extension. If you examine
    your apache config file then you will probably see examples of how to do
    this already there, but commented out. So, in that case could use

    and again the script (now called "script") will be run with
    "/more/path/info" as an input.
    -2-
    to completely remove the script name from the path you configure the
    server to simply pass all requests to the same script, though I'm not sure
    off hand what the configuration would be. Perhaps rewrite each path to
    include the script name.
    -3-
    to add a subdomain (e.g. ) is harder.
    Not harder really, but less likely to be possible for you. You need to
    add an entry into the DNS server that services the domain name. That is
    nowe technically dificult, but most of us don't have easy access to do
    that.

Re: creating "tinyURL" for my website


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 9 =
QUESTION ON "WWW"

EMSDN.COM