Short URL script

version 1.0.2



Live demo

Demo at this location





Installation

The install process consists of a single required step below and one further optional step.

Uploads

Upload index.php, urls.txt and the .htaccess file to either the root of your website or the root of a folder of your website.

Visit the location and the short URL script is ready to go! There are some optional file edits you may wish to make however. (See below)



File edits

Open index.php
Make sure to read the comments


Variables that can be edited

file
$file = 'urls.txt';

This is the location of the file which stores all the URLS. By default this will point to a text file in the same directory as index.php however this can be changed if you so wish.



use_rewrite
$use_rewrite = 1;

If you server does not support mod_rewrite or .htaccess files you must change this option to 0, otherwise it's best to leave as is.



language vars
	$l_url		= 'URL';
$l_nourl	= '<strong>No URL supplied</strong>';
$l_yoururl	= '<strong>Your short url:</strong>';
$l_invalidurl	= '<strong>Invalid URL supplied.</strong>';
$l_createurl	= 'Make shorter!';

These variables are used as outputs from the script. These only need to be changed to alter the style or text of the outputs (e.g. to translate them to a different language).

Make your edits as you wish, save and close index.php



Changelog

This section details changes to the script in its history by each released version.

Version 1.0.0

Inital release



Version 1.0.1

Second release with the following changes:

  • Changed default file store to text file
  • Added use_rewrite option
  • Added 'URL' language variable
  • Wrapped script in HTML wrapper
  • Added styles to default form
  • Catch errors from a failed redirect


Version 1.0.2

This version fixes the following bugs and errors:

  • Fatal error when redirecting pages

Help and support

You can get help, support for this script plus other web design and development tips from our webmaster forums: http://community.spyka.co.uk/forumdisplay.php?f=9


advertisement

Support

Need help, support or advice using or install our scripts? Take a look at our webmaster forums

Donate

Like our scripts? Consider a donation