In 2011, I needed an easy way to promote to one of my online projects on New York tourism to smartphone users and to do this, I needed to research how to create custom short URLs for a website.
Domain Name
My first task was to register (411ny.org) a shorter domain name then drop the following code into the .htaccess file in the root of the site.
# [ Custom Short URL ]
RewriteEngine on
RewriteRule ^/?$ http://411newyork.org [R=301,L]
RewriteRule ^(.*)$ https://bitly.com/$1 [R=301,NC]
# [ Custom Short URL ]
Bitly Pro Account
With the domain name registered, active, and loaded with the .htaccess file, it was time to register for a Bitly account so I can track stats and receive the API information to tie into my domain. Now, when a user types in 411ny.org/ZXMMS4 or http://411ny.org/1Q8pcfZ in the browser, they are redirected to this article and without having to pay enormous fees as what Amazon, Pepsi and news agencies would be paying.
Stephan Pringle
Latest posts by Stephan Pringle (see all)
- ADFS/CAS Time out - Thursday, September 19, 2024