Forum Discussion

navya_0204's avatar
6 years ago

How to redirect a URL based on page name or based on another url

Hi,

I am trying o redirect users to particular URL based on a page name, how can I do that ?

 

Thank you in advance!!

4 Replies

  • navya_0204's avatar
    navya_0204
    Helper
    6 years ago

     

    Thank you sunny_mody

    I went through the documentation and here is my code

    <#if page.name == "Enrollment "> ${http.response.setRedirectUrl(t5/Support-Case-Chat/ct-p/SupportCaseChat)}

    </#if>

    but the above code is not working can anyone let me know  whats the issue 

     

    Thank you!!

  • snaffle's avatar
    snaffle
    Expert
    6 years ago

    As far as I know this will only work with built-in Lithium pages, such as "CommunityPage", "ForumPage", "ForumTopicPage" etc - you can find the page name by looking at the classes applied to the body tag.

    I don't know of any page called simply "Enrollment" and having a look on our community, couldn't find one in the Pages area so I suspect that's part of your problem.

    Additional though, you'll want to use the "tapestryPrefix" variable in your redirect url and not use /t5/ in the path... so:

    <#if page.name == "CommunityPage">
    ${http.response.setRedirectUrl("${community.urls.tapestryPrefix}/Support-Case-Chat/ct-p/SupportCaseChat")}
    </#if>

     

    Hope that helps.