1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Setting Up A Short URL Forward

For an easier to remember URL

By

Although having an automated site is great, sometimes the rather long URLs they generate for sub-pages aren't very user friendly. These long addresses are hard to put on business cards, or to pass along to friends.

To make them more friendly you could use one of the many, many short URL services, but most come with strings. Or you can setup something similar right on your own website, using a PHP forward. Here is how:

1.) Create an easy to remember file name or folder, such as http://www/yoursite.com/mylink.php or http://www.yoursite.com/link. If you are creating a folder, the file inside the folder that holds the code would should be named index.php

2.) Put this code into your file:

<?php 
 header( 'Location: http://www.yoursite.com/this/is/a/long/url/you/want/to/direct/to.php' ) ; 
 ?>
Make sure you replace our long URL with the one you want to direct to.

3.) Upload the file, and share your new short URL with friends!

  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Step By Steps
  5. Short URL - PHP Short Address - Forward Short URL

©2014 About.com. All rights reserved.