Redirecting User to a Specific page in Power Portal
I was working in some requirement and for some business requirement I wanted to Redirect a page which is not available in my portal to another page. So to do this We have configured Redirects option available in power portal.
NOTE : Remember that the Re-direct will only work if the page the user trying to access in not available in your portal and you want to redirect to another page.
Let us say you have shared a specific URL to other external websites or third parties to hit a specific page of your portal and for some reason the page is not available. So with out changing all external website UTL as yo do not have authority to change, you can configure a Redirect which will redirect to a new page either temporarily or Permanent as per your requirement.
Also for some business scenario lets say you are trying to enhance the an existing page and temporarily you want to redirect to another page. Then you can rename the old page and configure a Redirect to a temporary page.
Go to Portal management App and click Redirects and Create new Redirect. In the Redirect Record you have to give below details.
- name : name of the Redirect record of your choice
- Website : the website for which the Redirect will apply
- Inbound URL : the partial page name that user will browse
- Status Code : Choose either Temporary Redirect / Permanent Redirect
- Web page : The web page to which you want to redirect
here I am redirecting from “contact” page to “Contact Us” page. Make sure the contact page is not available in your portal and that’s why you are redirecting to new page.
This above option will only work whenever the inbound page is not available. Now what if you want to redirect from one page to another and both page is available. Let say you have a home page and you want to redirect to SignIn page by default whenever someone loads home page of portal.
For this scenario the above Redirect option will not work. So you have to write some script.
For example if you want to redirect visitors from Home default page to SignIn page if the user is not logged in and Redirect to Contcat Us when the user logged in then you have to write the below script inside Home page Web Template.
{% if user %}
<script>
window.location.href='./contact-us/';
</script>
{% else %}
<script>
window.location.href='./SignIn/';
</script>
{% endif %}
Hope this will help