Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Trailing slashes for course action end points
Tagged: Course Action End points, redirect, trailing slash
- This topic has 13 replies, 3 voices, and was last updated 2 years, 5 months ago by Veronica.
Viewing 14 posts - 1 through 14 (of 14 total)
-
AuthorPosts
-
October 12, 2021 at 8:46 am #372586PhysiotutorsParticipantHello we have added an NGINX rule to add trailing slashes to all urls:
However the course action end points still don't add the trailing slashes. Is there a separate template that is used for those pages? See: https://prnt.sc/1vtnkj3 Where would we have to look or what can we do so that trailing slashes are also added to those pages? Manually editing the permalinks with a trailing slash "/" has no effect.if ($request_uri !~ "^/wp-json") { rewrite ^([^.]*[^/])$ $1/ permanent; }
October 14, 2021 at 1:40 pm #372812Anshuman SahuKeymasterWell this trailing slash does not creates any issue and are added from wordpress itself . We have added this deliberately in our code . to prevent this please try adding this given code in your wplms-customizer.php file in wplms customizer pluign :add_filter('wplms_save_vibe_course_permalinks',function ($permalinks){ foreach ($permalinks as $key => $permalink) { $permalinks[$key] = str_replace('/', '', $permalink); } return $permalinks; },99);
October 14, 2021 at 2:38 pm #372824PhysiotutorsParticipantThis reply has been marked as private.October 16, 2021 at 3:36 pm #372925Anshuman SahuKeymasterYes absolutely correct .October 18, 2021 at 8:28 am #372967PhysiotutorsParticipantOkay, thanks for having a look. If it's added all correctly then it's not taking effect as trailing slashes are still missing from the URLs.October 19, 2021 at 1:51 pm #373107Anshuman SahuKeymasterOk perhaps I did not understood the issue properly . Can you please explain do you wish to add the slash ? also please share exactly where you want to add or remove the slashes from url?October 19, 2021 at 2:42 pm #373111PhysiotutorsParticipantSo far trailing slashes are added to all URLs using an NGINX rule. However this rule cannot add trailing slashes to the URLs of the course action touch points seen here: https://prnt.sc/1vtnkj3 I assume these have to do with WPLMS theme. Here you can see the difference of pages that get the trailing slash added (e.g. forum): http://prnt.sc/1wqfpxn Here is how google chrome sees the course action touch point URLs where the trailing slash is missing from the "curriculum" slug: http://prnt.sc/1wqfrx5 I hope this explains it clearly. We would like to have trailing slashes added to the URL slugs of the course action touch point permalinks listed here: https://prnt.sc/1vtnkj3October 20, 2021 at 1:11 pm #373183Anshuman SahuKeymasterIn such case you can try adding the trailing slash in the permalinks settings itself : https://prnt.sc/1vtnkj3 We are building the urls using wordpress functions. The trailing slash is added when the curriculum page is opened however its just not showing in the html generated . Why exactly you need trailing slash for , is there any error its causing when trailing slash is missing ?October 21, 2021 at 10:09 am #373249PhysiotutorsParticipantHello Alex adding the trailing slashes manually in the permalink settings does not work/has no effect as mentioned in the initial support post. Our marketeer has asked us if it was possible to add the trailing slashes here for SEO benefits and would need to be displayed in the html generated.October 22, 2021 at 1:39 pm #373365Anshuman SahuKeymasterPlease try this code :add_filter('wplms_save_vibe_course_permalinks',function ($permalinks){ foreach ($permalinks as $key => $permalink) { if(in_array($key, array('curriculum_slug','activity_slug','members_slug','admin_slug','submissions_slug','stats_slug','news_slug'))){ $permalinks[$key] = $permalink.'/'; } } return $permalinks; },99);
November 1, 2021 at 8:52 am #373914PhysiotutorsParticipantHello Alex, Thanks for the new filter. however this also did not results in the desired outcome. see: http://prnt.sc/1y1h43f I can see in the URLs that works that there is an added "charset UTF-8". is that necessary to add the trailing slash in the html?November 3, 2021 at 11:14 am #374046Anshuman SahuKeymasterWell actually this can only be done by editing the core files on wplms. you need to add slash here : https://prnt.sc/1y9bw28 change this lineecho '<li id="'.$menu_item['id'].'" '.$class.'><a href="'.$menu_item['link'].''.((isset($menu_item['action']) && !isset($menu_item['external']))?$menu_item['action']:'').'">'.$menu_item['label'].'</a></li>';
to this :echo '<li id="'.$menu_item['id'].'" '.$class.'><a href="'.$menu_item['link'].''.((isset($menu_item['action']) && !isset($menu_item['external']))?$menu_item['action']:'').'/">'.$menu_item['label'].'</a></li>';
November 4, 2021 at 2:37 pm #374090PhysiotutorsParticipantThanks Alex, this works! We can close the threadNovember 6, 2021 at 11:43 am #374143VeronicaModeratorok thanks for your confirmation -
AuthorPosts
Viewing 14 posts - 1 through 14 (of 14 total)
- The topic ‘Trailing slashes for course action end points’ is closed to new replies.