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:
- The Page Title and Navigation Text fields are for admin use only in this case. So you can enter whatever works for you and your editors.
- In the URL Segment field enter the URL you wish the page to redirect to.
- Select your URL forwarding master page
- After you save, go to the Location tab and a route
Example:
If I want grabapipit.com/twitter to redirect to my Twitter account, I would:
- Add “Twitter” in the Page Title field
- Add a link to my Twitter profile in the URL Segment field
- Add
twitter
as a page route
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.