Welcome to the LimeSurvey Community Forum

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

htaccess url rewrite for admin links on upgrade LTS v3 to v5

  • fradeff
  • fradeff's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 3 months ago #236349 by fradeff
Hi
Just upgraded from LTS v3 to 5.4.13+221128
I've noted that old admin URLS like:
/index.php/admin/survey/sa/view/surveyid/265676
are now with this syntax:
/index.php/surveyAdministration/view/iSurveyID/265676
And I would lile previous admin URLs automatically redirected to new syntax
I've tried a couple of RewriteRules in the .htaccess but none worked
Has someone already written a similar rule?

Please Log in to join the conversation.

  • fradeff
  • fradeff's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 3 months ago #236389 by fradeff
found it! it was easier than I thought, no need of RewriteRule or RewriteCond, a simple Redirect works:

<IfModule mod_rewrite.c>
RewriteEngine on
Redirect /index.php/admin/survey/sa/view/surveyid /index.php/surveyAdministration/view/iSurveyID

Please Log in to join the conversation.

More
6 months 3 weeks ago - 3 months 1 week ago #246242 by sangitasharma
You can use Apache's mod_rewrite to create rewrite rules in your .htaccess file that redirect the old admin URLs to the new syntax.
Ex..
RewriteEngine On

# Redirect old admin URLs to new syntax
RewriteCond %{REQUEST_URI} ^/index\.php/admin/survey/sa/view/surveyid/(\d+)$
RewriteRule ^ /index.php/surveyAdministration/view/iSurveyID/%1 [R=301,L]

It checks if the requested URL matches the old admin URL pattern.

^/index\.php/admin/survey/sa/view/surveyid/(\d+)$.
This regular expression matches the old admin URL.  t captures the survey ID (\d+) at the end of the URL.
Once done your can test it manually or use browser developer tools to inspect network requests and redirects or use any online tool like redirectchecker*.*com  This can help you to get detail redirection chain and its status code.


 
Last edit: 3 months 1 week ago by DenisChenu.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose