Providing short links to questionnaires

Problem

You want to set up very short links to questionnaires.

Solution

Use the Apache RedirectMatch feature.

Discussion

CallWeb's short URLs allow for compact URLs. The syntax of short URLs is as follows

    http://domain.ext/callweb.cgi?language:project:telkey:first_question
    http://domain.ext/callweb.cgi?en:survey:123456:Q1

While the first two pieces of information are mandatory (the language and the project), the telkey and the first question values are not; they should be supplied if the context requires it.

Once could dispense with the reference to callweb.cgi in the URL by including callweb.cgi in the list of allowed starting pages in the Apache configuration. This is done by adding a DirectoryIndex instruction to the Apache configuration file:

    DirectoryIndex index.html callweb.cgi

The short URL above would then become http://domain.ext?en:survey:123456:Q1.

Of course, one would be well advised to use a short domain name rather than a long one. For example, http://97.ca translates into necessarily shorter and easier to communicate URLs than http://surveycenter.yourpreferredsupplier.qc.ca.

Another strategy is to use Apache's RedirectMatch instruction; it is extremely powerful. It can rewrite a URL according to components of the address supplied. For example, the following accepts the URL http://callweb.ca/survey and redirects the user to the following address http://callweb.ca/productionsite/callweb.cgi?_lang=EN&_proj=thissurvey:

    RedirectMatch ^/survey$ http://callweb.ca/productionsite/callweb.cgi?_lang=EN&_proj=thissurvey

This instruction takes the URL http://callweb.ca/survey/en/abcd and redirects to http://callweb.ca/productionsite/callweb.cgi?_lang=en&_proj=thissurvey&_telkey=abcd:

    RedirectMatch ^/survey/(..)/(.*)$ http://callweb.ca/productionsite/callweb.cgi?_lang=$1&_proj=thissurvey&_telkey=$2

Also, if no language parameter is passed along, CallWeb defaults to the browser preferred language (determined by the respondent), assuming it exists in the questionnaire. So, the RedirectMatch instruction above can be rewritten to avoid the language parameter altogether and to let CallWeb serve the respondent's preferred language:

    RedirectMatch ^/survey/(.*)$ http://callweb.ca/productionsite/callweb.cgi?_proj=thissurvey&_telkey=$1

This way http://callweb.ca/survey/abcd becomes http://callweb.ca/productionsite/callweb.cgi?_proj=thissurvey&_telkey=abcd and the respondent gets his/her preferred language if it exists (and the questionnaire default language if it does not).

Providing short links to questionnaires

Problem

You want to set up very short links to questionnaires.

Solution

Use the Apache RedirectMatch feature.

Discussion

CallWeb's short URLs allow for compact URLs. The syntax of short URLs is as follows

    http://domain.ext/callweb.cgi?language:project:telkey:first_question
    http://domain.ext/callweb.cgi?en:survey:123456:Q1

While the first two pieces of information are mandatory (the language and the project), the telkey and the first question values are not; they should be supplied if the context requires it.

Once could dispense with the reference to callweb.cgi in the URL by including callweb.cgi in the list of allowed starting pages in the Apache configuration. This is done by adding a DirectoryIndex instruction to the Apache configuration file:

    DirectoryIndex index.html callweb.cgi

The short URL above would then become http://domain.ext?en:survey:123456:Q1.

Of course, one would be well advised to use a short domain name rather than a long one. For example, http://97.ca translates into necessarily shorter and easier to communicate URLs than http://surveycenter.yourpreferredsupplier.qc.ca.

Another strategy is to use Apache's RedirectMatch instruction; it is extremely powerful. It can rewrite a URL according to components of the address supplied. For example, the following accepts the URL http://callweb.ca/survey and redirects the user to the following address http://callweb.ca/productionsite/callweb.cgi?_lang=EN&_proj=thissurvey:

    RedirectMatch ^/survey$ http://callweb.ca/productionsite/callweb.cgi?_lang=EN&_proj=thissurvey

This instruction takes the URL http://callweb.ca/survey/en/abcd and redirects to http://callweb.ca/productionsite/callweb.cgi?_lang=en&_proj=thissurvey&_telkey=abcd:

    RedirectMatch ^/survey/(..)/(.*)$ http://callweb.ca/productionsite/callweb.cgi?_lang=$1&_proj=thissurvey&_telkey=$2

Also, if no language parameter is passed along, CallWeb defaults to the browser preferred language (determined by the respondent), assuming it exists in the questionnaire. So, the RedirectMatch instruction above can be rewritten to avoid the language parameter altogether and to let CallWeb serve the respondent's preferred language:

    RedirectMatch ^/survey/(.*)$ http://callweb.ca/productionsite/callweb.cgi?_proj=thissurvey&_telkey=$1

This way http://callweb.ca/survey/abcd becomes http://callweb.ca/productionsite/callweb.cgi?_proj=thissurvey&_telkey=abcd and the respondent gets his/her preferred language if it exists (and the questionnaire default language if it does not).