Saturday, July 23, 2022

Using Redirects For Easy Profile Linking

301 Redirect

If you're anything like me, you probably have a plethora of user profiles all over the web. Most of these have some rather ugly URLs which makes sharing and linking to these profiles kind of cumbersome. For example, my user profile on Garmin Connect is https://connect.garmin.com/modern/profile/d04d79c2-2124-431d-b186-96e3ce48a7ba. If you're talking with a friend or at an event, you're probably not going to tell somebody to follow you and spell out a nasty URL like that. It's much easier to just tell them something like garmin.gregkjono.com and have that automatically forward them to that long cryptic URL.

This is done using HTTP redirects, or a forwarding service. HTTP redirects have been around for decades. In years past, you could use a web server to redirect users from one URL to another. Now, Google Domains allows you to easily setup redirects like this using their forwarding service. 

Web Forwarding

If you go into the advanced options you have some more options as well. You can choose whether it's a permanent redirect, or temporary.
Temporary or Permanent Forwarding

Path forwarding is another advanced option. If you choose "Do not forward" here, any file path with be redirected to the exact URL that you set to forward to. If you do forward paths, /file on one domain would redirect to /file on the domain that you forward to. Personally, I almost always choose to not forward paths.
Path Forwarding

The final advanced option is whether to forward SSL (HTTPS) requests as well. I enabled this every time, otherwise if somebody tries to use HTTPS, it would just fail.

SSL forwarding

None of these services have any additional fees, as long as you are using Google Domains as your domain registrar.

So, being I have gregkjono.com registered with Google domains, I was able to setup a lengthy list of redirects, like these

You can also go to a another level with these. For example, I have multiple Instagram accounts. What I did was redirect instagram.gregkjono.com to my main personal Instagram account. Then I added subdomains below instagram.gregkjono.com for my more focused Instagram accounts. So, now I have a list like this.
So, all-in-all, this is a simple trick to simplify your online presence. If you'd like more details on setting these up, Google has a walk-through in their help pages.