With nearly every resource a business uses these days being served through a browser, every application is now a URL. If you find yourself in IT, some portion of your job may be just managing the growing list of URL resources. What makes this even more challenging is when your applications are hosted by cloud providers using their own domains for serving your applications. To add even more and more complexity, some of these cloud providers have you access your application with lots of URI parameters (http://FQDN/Path/to/cgi?parameter1=value¶meter2=value,etc…).
Most in IT want to make their systems use short, memorable URLs to promote usage of their applications. To resolve the issue, instead, most companies have an intranet page that they use as a springboard to all of these URLs. But if each system could be accessed through a simple, short, memorable URL, it would make them so much easier to get to. This article discusses a couple easy methods for shortening URLs and how to Make Easy, Memorable URLs for your friends, employees, and the internet in general!
YOURLS (Your Own URL Shortener)
I recently had the opportunity to install a YOURLS instance for a friend. He needed a single, simple location to manage all of his URLS in one place. YOURLS works off of a single domain but allows you to make as many directory redirects as you want. For example, Let’s imagine that I have outsource my human resource system to a human resources cloud system provider such as infinisource or Bamboohr and I want employees to be able to get to the system using: http://uptimemadeeasy.com/hr. With YOURLS, you simply add the URL and then tell it the Custom short URL name that you want it to use.
With this in place, my employees will be able to access our cloud hosted HR system using the newly created http://uptimemadeeasy.com/hr URL.
YOURLS allows you to add all of the URLS that you want to shorten, allowing you to manage all of your links in one simple location.
Additionally, YOURLS keeps track of all of the URL links, and generates statistical reports on their usage that can be helpful to you to determine how they are being used.
Once you have your URL links configured in YOURLS, you can use the “Share” feature to share your links on Facebook and Twitter.
If you are interested in more information on YOURLS or in downloading it and installing it, visit the YOURLS webpage.
Use Apache for Domain Redirects
While YOURLS helps you work out your link shortening by using directories after your domain name, by using Apache redirects, you can use subdomains in your URL links instead.
The difference between using a subdirectory versus a subdomain is shown below:
Directory URL Link: http://www.uptimemadeeasy.com/hr Subdomain URL Link: http://hr.uptimemadeeasy.com
Here is how we can extend our hr link example to using a subdomain. We basically have 2 tasks to get this working. First, we need to add a CNAME DNS record to send our subdomain to an Apache webserver and second, we need an Apache webserver. Once again, we are trying to get people to this URL: http://hr.uptimemadeeasy.com -> https://www.myhrcloudprovider.com/UserLogin.aspx?id=uptime.
Step 1 – Create a CNAME DNS Record for Your Subdomain
I am planning to use the Apache server on my www.uptimemadeeasy.com website to handle the Apache redirect, so I need to add a CNAME DNS record in my DNS pointing to my www.uptimemadeeasy.com subdomain.
Step 2 – Add Redirect to Your Apache Config Files
Now that the hr.uptimemadeeasy.com traffic is being sent to my www Apache, I need to tell Apache what to do with the traffic. We will turn on the RewriteEngine and then use a RewriteCond and RewriteRule:
RewriteEngine On RewriteCond %{HTTP_HOST} ^hr\.uptimemadeeasy\.com$ [NC] RewriteRule ^(.*)$ https://www.myhrcloudprovider.com/UserLogin.aspx?id=uptime [R=301,L]
And with a quick Apache restart:
service httpd restart
We are done. By browsing to http://hr.uptimemadeeasy.com we will arrive at our hr system.
Latest posts by Jeff Staten (see all)
- Configure Your HP Procurve Switch with SNTP - May 5, 2015
- Configuring HP Procurve 2920 Switches - May 1, 2015
- Troubleshooting Sendmail - November 28, 2014
Great info! Remember Webpac?
Do I ever! Amazing how web products have improved from those old c-based cgi days.
Very good write-up. I definitely love this website. Keep it up!