본문 바로가기
limesurvey_라임서베이/global setting

url 줄이기[1] - index.php 삭제

by 거인과난쟁이 2023. 10. 28.

라임서베이를 통해서 제작한 설문 링크는 웹서버의 세팅을 통해서 다양화 할 수 있다.

그러나, 라임서베이 내부의 파일 설정을 수정만해도 효과를 낼 수 있다.

https://사이트이름/index.php/xxxxxx?lang=ko에서 만약 단일 언어로 제작된다면, 일반적으로

https://사이트이름/index.php/xxxxxx로 언어부분을 제외하고 링크를 공유할 수 있다. 

limesurvey/application/config/config.php 파일에서 작은 부분을 수정하자:

'showScriptName' => true, 를 'showScriptName' = false, 로 바꾸고 저장하면,

https://사이트이름/xxxxxx로 줄여진다. 문자 등으로 발송할때 간결해지면서 깔끔한 느낌을 추가한다.


그러나 몇 가지 추가 작업을 진행해야 한다.

1. 라임서베이 디렉토리에 있는 .htaccess 파일을 편집한다. (/var/www/html/limesurvey/에 있다)

                                        
<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 . index.php [L]

    # deny access to hidden files and directories except .well-known
    RewriteCond %{REQUEST_URI} !^/\.well-known
    RewriteRule ^(.*/)?\.+ - [F,L]

    # deny access to composer.json that is used for remote fingerprinting
    RewriteRule ^composer.json - [F,L]
</IfModule>

2. ssl 관련 파일의 일부를 수정한다. 서버에 certbot이 설치되어 있고, "Let's Encrypt"를 사용하여 SSL 인증서를 발급하거나 관리하는 데 사용되었다면, Apache 설정 파일 중 000-default-le-ssl.conf를 우선적으로 확인하고 수정한다. /etc/apache2/sites-available/ 에 파일이 있다.

    <Directory /var/www/html/limesurvey>
        AllowOverride All
    </Directory>

을 추가하는 것이다.

ServerName limesurvey.kr
SSLCertificateFile /etc/letsencrypt/live/limesurvey.kr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/limesurvey.kr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

    <Directory /var/www/html/limesurvey>
        AllowOverride All
    </Directory>

</VirtualHost>
</IfModule>

그리고, sudo systemctl restart apache2 를 실행하여 설정을 시스템에 업데이트한다.