Redirect [domain].com to [domain].com/[survey-address]

More
4 years 4 months ago #92964 by bdesign
bdesign created the topic: Redirect [domain].com to [domain].com/[survey-address]
Hi,

I'm using LimeSurvey v2.0

I've changed my .htaccess file to read:

<IfModule mod_rewrite.c>
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . http://[domain-name].com/index.php/survey/index/sid/383338/newtest/Y/lang/en
</IfModule>

I've done this so people visiting the domain are directed to the survey without any hassle.

This causes [domain-name].com/admin/ to redirect to said survey. I have to enter [domain-name].com/admin/index.php to access the back end.

Is there any way I can redirect visitors to the survey in a cleaner way? I envision this might cause errors I would prefer to avoid.

Thank you.

Please Log in to join the conversation.

More
4 years 4 months ago #92969 by DenisChenu
DenisChenu replied the topic: Redirect [domain].com to [domain].com/[survey-address]
You just want to have default home page to a specific survey.

Then:
RewriteRule ^$ /index.php/survey/index/sid/383338/newtest/Y/lang/en [R=temp,L]

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
4 years 4 months ago #92970 by bdesign
bdesign replied the topic: Redirect [domain].com to [domain].com/[survey-address]
Thank you!

I knew it was a noob question. It had to do with .htaccess more than LimeSurvey. :pinch:

Thanks again.

Please Log in to join the conversation.

More
4 years 4 months ago #92974 by DenisChenu
DenisChenu replied the topic: Redirect [domain].com to [domain].com/[survey-address]
Complete htaccess for LS:
<IfModule mod_rewrite.c>
    RewriteEngine on
 
    RewriteRule ^$ /index.php/383338 [R=temp,L]
 
 
    # if a directory or a file exists, use it directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
 
    # otherwise forward it to index.php
    RewriteRule . index.php
</IfModule>

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
4 years 4 months ago - 4 years 4 months ago #92975 by bdesign
bdesign replied the topic: Redirect [domain].com to [domain].com/[survey-address]
Thanks!

First I tried:
DirectoryIndex http://[domain].com/index.php/survey/index/sid/383338/newtest/Y/lang/en
RewriteEngine on
RewriteRule ^$ /index.php/survey/index/sid/383338/newtest/Y/lang/en [R=temp,L]

Which sort of worked. But your updated version is a lot more practical.
Last Edit: 4 years 4 months ago by bdesign. Reason: code

Please Log in to join the conversation.

More
4 years 4 months ago - 4 years 4 months ago #92977 by Ben_V
Ben_V replied the topic: Redirect [domain].com to [domain].com/[survey-address]
Maybe just set a redirection to your survey (using javascript or meta refresh tag) into the surveylist.pstpl file of you default template (template used by your platform root url; can be different than your survey template ).

I don't know if it's exactly what needed, but try it (disable htaccess for testing).

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last Edit: 4 years 4 months ago by Ben_V.

Please Log in to join the conversation.

More
4 years 4 months ago #93054 by helper
helper replied the topic: Redirect [domain].com to [domain].com/[survey-address]
Forgive me if I misunderstand, but what bdesgin may be looking for is a "short URL" - this can be accomplished in the Apache httpd.conf (put at the end or put in your virtuals file) something like this:
Redirect /shortURL /index.php/167493?lang=en

This will redirect anybody that comes in on http://[domain]/shortURL to the default survey. Note that you can use multiples here if you have more than one survey.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now