Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Can I change the URL Parameters ?

  • OngJunYew
  • OngJunYew's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 9 months ago #202374 by OngJunYew
Can I change the URL Parameters ? was created by OngJunYew
Hi,

I just want to know can i shorter my URL paramters from "http://localhost/survey/11?token=zxc123&lang=en" to something like this "http://localhost/survey/11?=zxc123" ?

- delete the token text from the url
- delete the lang=en from the url

Thank You
The topic has been locked.
More
3 years 9 months ago #202380 by jayat
Replied by jayat on topic Can I change the URL Parameters ?
Hi,

you can delete the lang from the url ( i do this often becouse i have only one language)
you need the token to start the survey or you make the survey avalibel for all

regards
jan
The topic has been locked.
  • OngJunYew
  • OngJunYew's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 9 months ago #202382 by OngJunYew
Replied by OngJunYew on topic Can I change the URL Parameters ?
Hi, thanks for your reply

Basically, I need to run my survey with token and two different language. Will I able to shorten the URL as have stated ?

Thank You
The topic has been locked.
More
3 years 9 months ago #202383 by jayat
Replied by jayat on topic Can I change the URL Parameters ?
if you delete the token part the user must type in the token to start the survey and so he need the token
without the language it starts with the main language of the survey (i think) when the user can change the language he can decide
I don’t know the test setting but maybe you can use a QR code to start the survey
Or you can use short url for each token
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #202384 by Joffm
Replied by Joffm on topic Can I change the URL Parameters ?
No,
because you may add several parameters, the application has to know to which variable the value belongs.
As you may change the order of parameters, the name of the parameter is necessary

Like
survey.mylime.com/123123?lang=de&newtest=Y&token=abc&myParam=ZZZ111
survey.mylime.com/123123?token=abc&myParam=ZZZ111&newtest=Y&lang=de

So not shorter than "survey.mylime.com/123123?token=abc"

Regarding the language:
If you have the language of the participants in the participant table it's not necessary to add it to the url.
The survey starts with the language of the participant table.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • OngJunYew
  • OngJunYew's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 9 months ago #202421 by OngJunYew
Replied by OngJunYew on topic Can I change the URL Parameters ?
Hi,

Then is there anyway to delete the language parameters from the URL? Because I have the language of the participants in the participant table.

Thank You
The topic has been locked.
  • OngJunYew
  • OngJunYew's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 9 months ago #202426 by OngJunYew
Replied by OngJunYew on topic Can I change the URL Parameters ?
Hi,

Is there any solution to change the variable name "token" to another variable name as well such as only one alphabet "t".

Thank You
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #202430 by DenisChenu
Replied by DenisChenu on topic Can I change the URL Parameters ?
If you use apache (seems to be) : you surely can use rewrite , maybe something like this 123123-XXXX rewritten to sid=123123&token=XXXX

httpd.apache.org/docs/current/en/rewrite/intro.html

Else you can update your config to manage the rules of the url manager
www.yiiframework.com/doc/blog/1.1/en/final.url

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #202433 by Joffm
Replied by Joffm on topic Can I change the URL Parameters ?

Then is there anyway to delete the language parameters from the URL? Because I have the language of the participants in the participant table.


You read my answer?

If you have the language of the participants in the participant table it's not necessary to add it to the url.
The survey starts with the language of the participant table.


And your second question:
I could imagine you have to change the source code.

As I don't know why you want to do this, you could workaround by:
create a small php programm - called "index.php" in subfolder "s".

Reach by "localhost/s/?t=ABCabc" (and this is really short)

this only grabs the t-parameter and calls your survey with the correct syntax.
Rough example - without validation
Code:
<?php
//SurveyID is hardcoded
$surveyID=123456;
if (!isset($_GET["t"]))
{
  $token=$_GET['t'];
 header ("Location: https://survey.myLimeserver.com/".$surveyID."?token=".$token);
?>


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • OngJunYew
  • OngJunYew's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 9 months ago #202436 by OngJunYew
Replied by OngJunYew on topic Can I change the URL Parameters ?
Hi joffm,

Thanks for your reply.

I already figure it out how to delete the lang="en" parameter in the URL and the Survey will show the page based from the language of the participants in the participant table.

Now I just hope that I can make the variable name "token=" to something shorter such as "t=" to have a short and clean URL.

Thank You.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose