04-04-2011, 03:16 PM
[Tutorial] How to Make Your Own Mass URL Shortener
first, head over to your favorite domain registrar. (godaddy, namecheap, enom, etc)
type in 2 random numbers and 1 random letter to get a 3-letter domain name. the cheapest 2-letter TLDs are .us and .me at around $8, and 90% of them aren't taken yet.
(or you can just get the .info you're broke and don't mind the 2 extra letters)
example: 4m5.us (uber-short!)
attach it to any ol' hosting. free hosting works just fine, as all we'll be doing is bouncing redirects off of it.
open up notepad and create this php file:
index.php
PHP Code:
put the index.php at the root of your domain, and make sure to delete any index.html or index.htm files that may already be there.
then you can link your shortened urls like this: (where the number at the end is the index of the url you want to redirect to)
Code:
enjoy
first, head over to your favorite domain registrar. (godaddy, namecheap, enom, etc)
type in 2 random numbers and 1 random letter to get a 3-letter domain name. the cheapest 2-letter TLDs are .us and .me at around $8, and 90% of them aren't taken yet.
(or you can just get the .info you're broke and don't mind the 2 extra letters)
example: 4m5.us (uber-short!)
attach it to any ol' hosting. free hosting works just fine, as all we'll be doing is bouncing redirects off of it.
open up notepad and create this php file:
index.php
PHP Code:
PHP Code:
<?php
$a = array(
0 => 'http://www.google.com',
1 => 'http://www.yahoo.com',
2 => 'http://www.ask.com',
3 => 'http://www.meatspin.com',
4 => 'http://www.blackhatworld.com',
);
header('Location: ' . $a[$_SERVER['QUERY_STRING']]);
?>
then you can link your shortened urls like this: (where the number at the end is the index of the url you want to redirect to)
Code:
Code:
4m5.us?3
enjoy