This is how I believe a simple URL shortener can be implemented using PHP. A new directory with an initialized index.php which redirects to your desired url is created each time you shorten a URL. The 'choose your own short link' functionality hasn't been added yet.
The python file 'combinations.py' here gives out the number of unique combinations of 'k' letter words you can obtain from the given list of letters. Currently, my code creates folders whose names are 5 characters long and are randomly selected as a permutation of the list of letters.