def get_relative_url(url):
    """
    Returns the relative URL from a URL. For example:

    'http://web.net' -> ''
    'http://web.net/' -> ''
    'http://web.net/1222' -> '/1222'
    'http://web.net/wsadas/asd' -> '/wsadas/asd'

    It will never return a trailing "/".

    @param url: A url to transform
    @type url: str

    @return: relative URL
    """
    stripped_site_url = url.replace('://', '')
    baseurl = '/' + '/'.join(stripped_site_url.split('/')[1:])
    if baseurl[-1] == '/':
        return baseurl[:-1]
    else:
        return baseurl
