Change default redirect from /admin to something else

Product: PowerShell Universal
Version: 2.10.2

Hey PSU folks,

When you browse to http://localhost:5000 you are automatically redirected to /admin. How can I change that? Let’s say I have dashboard called /home, I’d like to have users redirected to /home when they browse to http://localhost:5000.

Thanks,
Rob

I do it by setting the dashboard’s URL to “/” and it works fine. I can manually add admin to the URL to get back to the admin page.

image

Thank you @dbytes! I found this does work, however I’m wanting to point it to use a multi-page dashboard and doing so messes up the Url convention I have in place with company branding. I’m sure I could rework things, if needed, but wondering if there’s a way with appsettings.json or something like that?

I have four dashboards and one of those is a multi-page dashboard. The others are single page. One of the dashboards does some redirection as I have one of the single page dashboards using a alias that is customer facing.

I use universal.domain.com for the IT dashboards and contractors.domain.com for a user facing dashboard.
image

The dashboard listed as “dashboard” handles redirects for me. Server Dashboard is multi-page.

My dashboard with / looks like the below so maybe this will help:

$UDScriptRoot = $PSScriptRoot

#theme
. "$UDScriptRoot\..\theme.ps1"

New-UDDashboard -Title 'Redirecting...' -Theme $Theme -HeaderBackgroundColor $BackColor -Logo $Logo -DisableThemeToggle -Content {
    #$headers | ConvertTo-Json | Out-File C:\Temp\Redirect.json
    switch -Wildcard ($Headers.windowlocation) {
        '*contractmgmt*' { Invoke-UDRedirect -Url 'https://contractors.domain.com/home' }
        '*contractors*' { Invoke-UDRedirect -Url 'https://contractors.domain.com/home' }
    }
}

1 Like

Thank you for the additional info and example!

Creating a “/” dashboard to simply redirect where I want the root site to be…works great!

Thanks,