- Posts: 52
- Thank you received: 16
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
- Topic Author
- Offline
- Senior Member
Less
More
1 year 3 months ago #236349
by fradeff
htaccess url rewrite for admin links on upgrade LTS v3 to v5 was created 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?
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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 52
- Thank you received: 16
1 year 3 months ago #236389
by fradeff
Replied by fradeff on topic FIXED htaccess url rewrite for admin links on upgrade LTS v3 to v5
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
<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.
- sangitasharma
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 2
6 months 3 weeks ago - 3 months 1 week ago #246242
by sangitasharma
Replied by sangitasharma on topic htaccess url rewrite for admin links on upgrade LTS v3 to v5
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.
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.