UrlProperty(string url, string property, [string queryParam, string queryValue])

Returns requested property of an url.

Properties

In the following examples this url is used as reference A1:
http://niels@sub.domain.co.uk:1090/path/to/ file.aspx?a=b&c=d=e#fragment

Absolute

Returns the absolute url. If the url is misspelled, i.e. htp:/mydomain.com this is corrected.

=UrlProperty(“domain.com”;”absolute”) => “http://domain.com =UrlProperty(“htp:/mydomain.com”;”absolute”) => “http://domain.com” =UrlProperty(A1; “absolute”) => “http://niels@sub.domain.co.uk:1090/path/to/file.aspx ?a=b&c=d=e#fragment”

Host

Returns the host of the url.

=UrlProperty(A1; “host”) => “sub.domain.co.uk”

Domain

Returns the domain of the url. UrlProperty is aware that some top level domain have second level domains (such as co.uk).

=UrlProperty(A1; “domain”) => “domain.co.uk” =UrlProperty(“sub.domain.com”;”domain”) => “domain.com”

Tld

Returns the top level domain of the url.

=UrlProperty(A1;”tld”) => “uk”

Registrar

Returns the second level domain if applicable together with top level domain.

=UrlProperty(A1;”registrar”) => “co.uk” =UrlProperty(“mydomain.com”;”registrar”) => “com”

Fragment

Returns the fragment (location within a resource) of the url.

=UrlProperty(A1;”fragment”) => “fragment”

User

Returns the user information of the url.

=UrlProperty(A1;”user”) => “niels”

Scheme

Returns the scheme of the url.

=UrlProperty(A1;”scheme”) => “http”

Port

Returns the port of the url.

=UrlProperty(A1;”port”) => “1090″

Path

Returns the path referenced in the url if applicable.

=UrlProperty(A1;”path”) => “/path/to/”

File

Returns the file name referenced in the url if applicable.

=UrlProperty(A1;”file”) => “file.aspx”

Extension

Return the extension of the file referenced in the url if applicable.

=UrlProperty(A1;”extension”) => “aspx”

Query

If no queryParam specified the entire querystring is returned. Otherwise returns the value of specified query parameter.

=UrlProperty(A1;”query”,”a”) => “b”
=UrlProperty(A1;”query”,”c”) => “d”
=UrlProperty(A1;”query”,”x”) => “”

Adding a fourth parameter queryValue with property “query” allows you to set the queryValue of a queryParam in an url.

=UrlProperty(“http://domain.com/Default.aspx?a=b&foo=x”;”query”;”foo”;”bar”)
=> http://domain.com/Default.aspx?a=b&foo=bar

Get help with this function in the SeoTools Community Forum.

 

2 Responses to UrlProperty

  1. Darroch Reid says:

    Could you add an alias for ‘extention’ called ‘extension’?
    =UrlProperty(A1;”extension”) => “aspx”

    It would do the same thing, just make more sense in English.
    Thanks
    Darroch