Simple URL Forwarding with Routes

Perch Runway’s Routing is a powerful feature. One of the things you can achieve with Runway’s routing is URL forwarding even though it isn’t the primary use case for it.

What is URL Forwarding?

URL forwarding is redirecting a URL to point to another URL. For instance, you can redirect example.com/twitter to your Twitter account.

Some services such as Cloudflare offer URL forwarding, but you can also implement this directly from Perch Runway’s control panel.

URL Forwarding in Runway

First create a new master page templates/pages/url_forward.php (or call it whatever you want). It’s a one-liner:

<?php PerchSystem::redirect(perch_page_url(['include-domain' => false], true)); ?>

Log into the control panel and create a new page:

Example:

If I want grabapipit.com/twitter to redirect to my Twitter account, I would:

Is this useful?

Besides social media accounts, URL forwarding can be useful for referral links. For instance, some services have affiliate programs and they provide you with unique links for you to share with others. Instead of giving your audience the link as is (which may have long URL parameters), you can set up a URL forward to the link to make it easier to remember example.com/company-name.

It’s also easier to update. For example, if you send out a newsletter and include a broken referral link, you would send out another email to your audience with the correct link. On the other hand, if you had set up a URL forwarding link and used it in the newsletter, you can simply update it in the control panel.

link

Related articles