Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at firstname.lastname@example.org
Recently I was working in some portal customizations for my client and one of the requirements that came in was to place a re-direct for a portal url. If you are unware of redirects in Portals, this docs link is the perfect place to get started.
To put it short, you can create a redirect URL for an request so that when an incoming request is received for the URL, the user is redirected to a new URL/ page that you have configured.
So the portal developer went ahead and created a redirect url similar to the below one.
So basically when the user tries to navigate to the Left Nav Page, the user should be redirected to the Maintenance page. If you want the user to be redirected to an external URL, just fill in the value for Redirect URL field and you should be good. All fields are explained in docs link I shared at the start of this blog.
I have designed a kind of mock here for this blog post. The home page was kind of like below.
As it was expected, when the user clicks on the “Left Navigation Page” now, the user should be redirected to the Maintenance page as redirected as per the redirect rule.
However surprisingly enough, the redirection didn’t happen and the user was taken to the usual page configured for that link.
The first impression as it comes along is the redirection is not happening and if this is the first time you are working with redirects, you are bound to get confused.
To understand whether it is happening or not, here is the thumb rule to remember which I could understand purely based on my experience and not something explicitly written – “If the inbound url configured for redirect is already existing, and a web link is referring to the url, the redirect URL for that incoming URL would never fire when the link is clicked and the original page shall still be displayed”.
In this example – the left-nav-page url was still pointing to a valid webpage and hence the redirection never took effect.
So when does redirection really happen. If you are browsing a legacy URL which no longer exist or a webpage link which customer have saved as bookmark but the page url has been modified, redirect URL comes into the picture. If the inbound URL could not be matched with any existing URL’s, redirect rule would start taking effect if a rule is being configured for that inbound request. The Microsoft docs link infact says so – “Customers frequently want to have a simple URL that redirects to a page deeper in the site, or they want to allow for a legacy URL to be used with the site and automatically redirect to a new URL in the site.” But trust me, interpreting this and understanding can be a tough one to start with.
So for this example here, we just changed the URL of the page from “left-nav-page” to “left-nav-page-bak”. Now when we browse the URL – <a href=”https:///left-nav-page”>/left-nav-page”>https://<portalurl>/left-nav-page, we are redirected to the maintenance page as configured in the redirect URL.
Simple one yet tricky. Hope this helps!
Our product offerings:
Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)
CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)
Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)