Search code examples
php.htaccessmod-rewritelimesurvey

LimeSurvey: Skip "The following surveys are available" Page?


I have recently installed the latest LimeSurvey, and while it has many features I like, I only really intend on having one survey available at a survey.example.com subdomain.

I want to skip the page that states "The following surveys are available:" which is the "survey.example.com/index.php". and go straight to the survey, which is "survey.example.com/index.php/311746?lang=en"

I tried setting a DirectoryIndex in .htaccess but that didn't do anything

DirectoryIndex index.php/311746?lang=en

I've tried playing with mod_rewrite, but LimeSurvey itself already has conditions set up, so whatever I tend to do breaks theirs (likely since they're already rewriting index.php).

<IfModule mod_rewrite.c>
RewriteEngine on

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

# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>

I was going to try a redirect, but the index.php is more than just the index, so I don't want to change that too much.

I've tried searching around but I haven't had much luck.


Solution

  • Then why not just rewrite the main rule of the survey. Instead of rewriting it to the main index.php which you don't want to do, write it directly to the survey you want. You should be able to use this in your htaccess to go directly to the survey.

    <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 the survey
    RewriteRule . index.php/311746?lang=en [R=301,L] 
    </IfModule>
    

    Let me know if this solves your issue