Premium URL Shortener

Premium URL Shortener is a PHP script that allows you to run your own URL shortening website.

Documentation on how to set up and use Premium URL Shortener. This guide also cover all of its major features. If you stumble upon an issue or if you need help, please contact us.

Found an issue? Please open an issue at our official GitHub page and we will resolve it as soon as possible


Two types of license are available: Regular or Extended. If you are using this script for multiple websites, you must buy a license for each of them.

Items purchased under a Regular or Extended License may NOT be redistributed or resold "as-is" or as part of any other collection of image resources or files. You do not own the software but simply own a license to operate it therefore the author of this item has full rights on this item.

Regular License Examples (from Envato)

Use, by you or one client, in a single end product which end users are not charged for. The total price includes the item price and a buyer fee. The Regular License could be used for the following:

  • Single website (commercial, personal, or non-profit).
  • Single website for a client (commercial, personal, or non-profit).
  • Single intranet site project.

Extended License Examples (from Envato)

Use, by you or one client, in a single end product which end users can be charged for. The total price includes the item price and a buyer fee. The Extended License could be used for any of the following:

  • An online service where the file can be displayed on multiple users' pages.
  • Part of a software package for sale such as SaaS.


This script comes with a quick installer. All you have to do is to follow these simple instructions. It has been reported that the web installer may not successfully run on some servers. If that happens to you, please follow the manual installation instructions below.

Using the Web Installer Video Tutorial

  1. Upload and extract "" to your server
  2. Point your browser to
  3. Follow the step by step instructions
  4. The script will delete the install.php after installation: Just make sure that it has been deleted.
  5. Login as admin using the credentials you set at step 3
  6. Click on "Admin" button at the top and go to settings to configure the application.

Make sure the file install.php has been deleted from the root directory where the script is installed.

The automated installer will set up the mySQL database, create your configuration file and set up your administrator account. After this, all you have to do is to either go through this documentation to get yourself familiar with the script or you can go ahead and experiment everything on your own and come back here if you have any issues. Also don't forget that if you have any problems, you can always contact us.


Please note that if you have customized the software and you proceed to upgrade, your changes will be lost.

All upgrading instructions are detailed in the new online dedicated changelog for Premium URL Shortener. There you will find instruction according to the version of the script. Please note that some update may require you to replace all files while others only a couple of files. In both cases it is strongly recommended that you first backup all your existing files and download it to your computer.

View Changelog

Using the AutoUpdater (v5.4+)

  1. Find your purchase code in the "Downloads" section of CodeCanyon.
  2. Go to the admin panel and in the left menu click on Upgrade.
  3. If you are eligible to autoupdate, the checks will be green
  4. Enter your purchase code and proceed on upgrading.

It is strongly recommended to backup your files regularly as in rare occasion an update might not work with your server configuration and you need to roll back.


To migrate from one server to another, you need to proceed with care to not lose any data or functionality. Please follow the instruction below to letter without skipping anything to prevent loss of data.

  1. Enable maintenance mode in the admin panel > settings.
  2. First backup and download all your files (compress and download)
  3. Go to phpmyadmin > your database > export the shortener database
  4. On your new server, go to phpmyadmin > new database > import the SQL file
  5. If you are changing your domain name, go to the settings table then change it under "url".
  6. Then on your new server, upload and extract the compressed files
  7. Open the file includes/config.php and change your database info manually.
  8. Finally, login as admin and disable maintenance mode.

If you are having trouble migrating, our team can help you migrate safely! Please contact us.

Redirection Types

The script offers 5 types of the redirection that you can use. Each of them are explained below.

Direct Redirection

A direct redirection method redirects the user without any intermediate page. This is done via the server redirect. When sharing the link having a direct method, crawlers will fetch directly the target page. When using a pixel with direct method, a page is shown briefly before redirection and it is required for the pixel to work.

Frame Redirection

The frame redirection method is useful when you want to cloak a website like an affiliate page. It will show bar at the top with the site information, an ad slot and some buttons to share or close the frame.

Note that some websites do not work with this method because of a security rule that forces browsers to hinder iframes.

Splash Redirection

The splash page is an intermediate page very useful to give the user a preview of the page they are about to be redirected. It serves as a measure of protection and gives the user some time to react and decide whether they want to continue or not.

Custom Splash Redirection

The custom splash redirect is a premium feature that allows customers to create their own promotional page and associate it to a short link. A user going through the custom splash page will see a promotional page briefly before being redirected.

Overlay Redirection

The overlay feature is a cool feature that allows you to use dynamic lead widgets. It uses the same principal as the frame method but without the top bar. Instead it injects some cool widgets like a popup message, contact form and a poll.

In-App Translation

You can easily translate almost every text in this application without the hassle of editing PHP files. Just login as admin, go to settings then click on "Languages" and follow the instructions. Please note that this feature may not work on some hosts due to memory limits. In this case you will need to follow the manual instructions below.

Manual Translation

Now you can easily translate most of the text in this script. Language files are located (and have to be located) in includes/languages/<YOUR 2-LETTER LANGUAGE CODE>.php. Please note that some texts are too long to be translated this way, however you can do it another way (explained below). Once a user changes the language of the website, a cookie that includes the user's language preference will be set. If the user revisits the website, the script will automatically read the cookie and switches the language.

How Translation Works

The process of the translation is pretty easy. All texts are stored in an array and then a function is used to read and assign the proper translation of the text. If you open one of the PHP files, you will notice a lot of echo e('TEXT'). The function e is the function that reads and assigns everything. The name of the translation file is the language code of your language e.g. fr.php the code is fr for French. To use it simply, add to any link ?lang=LANGUAGECODE in this case ?lang=fr

Translating Texts

If you go in the includes/languages/ you will notice two files "fr.php" and "lang_sample.php". "fr.php" is an example of language file while lang_sample.php is a translation-ready file. If you want to understand how translation work, open "fr.php" and have a look at it. You will notice the following format (only the blue part must be changed):

The most important things to remember are the following:

  1. DON'T DELETE $lang = array( and ); at the end.
  2. DON'T EDIT THE LEFT SIDE, if you edit it then translation will not work anymore
  3. DON'T FORGET DOUBLE-QUOTES BEFORE AND AFTER, if you do, you see will an error
  4. DON'T FORGET THIS "=>", if you do you will see an error

Translating other Parts

If you want to translate some parts that are yet to translate, do as following.

  1. Open the file that contains the text
  2. Wrap the text with this: <?php echo e('TEXT')?>
  3. Open your language file and then add anywhere "TEXT" => "TRANSLATED TEXT",
For pages, if for example your page name is "About", open your language file then add:


Translating Custom Pages

If you wish to translate one of the custom pages, please follow these instructions.

  1. Create the original page in English (says the name is My page where the permalink will be
  2. Create another page and put the translated name of the original one which in our example will be Ma page. If you choose to leave the slug field empty the system will create the following sluge: ma-page. DON'T leave that empty! Instead type-in manually my-page_LANGUAGECODE. So if you create a page with the following slug my-page_fr if a user decides to switch the language to French the system will attempt to get the content of that page first. If it doesn't exist, it will use the original one.
  3. Also make sure to not show the translated page in the menu but do show the original one. The system will take care of that.
<?php echo e('Consequat aliquip do tempor velit esse in proident anim culpa sed nulla.') ?>
"Consequat aliquip do tempor velit esse in proident anim culpa sed nulla." => "Translated string in any language you wish",
$lang = array(
  "Consequat aliquip do tempor velit esse in proident anim culpa sed nulla." => "Translated string in any language you wish",
  "Dolore occaecat nisi tempor cillum dolore in mollit excepteur in aliqua culpa sunt enim pariatur dolore ullamco consequat culpa." => "Translated string in any language you wish",


The theming system has been greatly simplified to allow easy customization. It is now using bootstrap 3.1. All themes are located in the folder themes. If you open the default theme file you will see many files in that folder. Those are all the theme files you can modify. The folder named shared includes some important files that you should not modify unless you know what you are doing.

Using the editor

The script has a powerful theme editor built-in. The theme editor includes a code editor that you can use to easily change things. The code editor (ACE) is set to format only HTML and CSS. It will NOT format PHP. All php codes will be treated as text. You should not touch any PHP code unless you have the knowledge. There are some codes you can edit and these are explained below. You also have the ability to clone a theme by clicking on the clone button. You cannot however delete a theme from the script. You will need to do this by deleting the folder manually. This feature was not implemented because the deletion process is very sensitive and differs from server to server.

Theme API

The new theming system offers an easy to use API that you can use to custom things like widgets and features.

Shortener Form

You can invoke the shortener form anywhere by using the following code: $this->shortener($options = array());. This function will output the shortener form in any of the theme files. You can also customize by adding some options.

In the code example to the right, autohide will autohide the advanced features, advanced will either show or remove advanced features and multiple will show or remove the multiple URLs option.

$options = array('autohide' => Boolean (TRUE or FALSE), 'advanced' => Boolean (TRUE or FALSE), 'multiple' => Boolean (TRUE or FALSE));
 $this->shortener(array('autohide' =>TRUE, 'advanced' => TRUE, 'multiple' => TRUE))

Theme Widgets

The theming system include some widgets you can use via the theme editor. To call a widget, use $this->widgets('Widget_Name', $options = array()). The list of widgets available is described below along with the options you can configure.

  • Name: activities - Options: limit (the number items to list), refresh (Refresh time in milliseconds)
  • Name: countries - Options: None
  • Name: top_urls - Options: limit 
  • Name: tools - Options: None
  • Name: social_count - Options: None
  • Name: news - Options: None
 $this->widgets('activities', array('limit'=>10, 'refresh' => 10000))​;

Theme Menus

Menus are now built-in to the core however you can still customize them. Two menus are available: menu($options = array()) which controls the header menu and user_menu($options = array()) which controls the sidebar menu of the dashboard. Both menus are added in the file header.php in the theme folder.

Both menu accepts custom links send as an array(). See the example to understand how to add custom links via the theme API. If you want to edit custom links, you can check the file includes/App.class.php under function menu()

$links = array(
    array('href' => '', 'text' => 'Google'),
    array('href' => '', 'text' => 'Apple')
// Main Menu
// Sidebar Menu

Bundles & Link Rotator

The bundle feature allows you to regroup some links and will generate you a special link where you will be able to send that to people. That special link will allow them to see all links in the bundle and use them.

To add a link to a bundle:

  1. Under the link, hover on option then click Add to Bundle.
  2. You will see the bundles in a dropdown menu.
  3. If you don't see any bundles, you will need to create one first.
  4. New You now have the option to generate a "Rotator" link.

Links Rotator

This new feature allows a bundle to act as a rotator. The special link will rotate links randomly and will send the user to short link within the bundle.


TThe pixels tracking are used by ad platforms such as Facebook and Adwords to allow you to gather data on your customers and how they behave on your website. By adding your pixel ID from either of the platforms, you will be able to optimize marketing simply by using short URLs.

To add a pixel:

  1. Under the Pixel page, add your desired pixel including a name and the pixel ID
  2. When shortening, click on advanced option, browse to the end of the block and you will see an option to select the pixel

New Team Feature

The new team feature allows you to invite members to your group and operate the same account as a team. This is perfect for collaboration! To use this feature, the team leader must invite users and users will need to accept the invitation via email and create an account. Once the account has been created, members can access the same environment as a team member.

To add a user to a team:

  1. Under Team, enter the member's email
  2. Then choose the events to authorize this user.
  3. Send Invite


Please note that the team member is only allowed these permissions and nothing more.


The script offers two methods of tracking (and you can disable this): System and Google Analytics. When choosing the system method, the script will tracking users on its own and log data in the database. On the other hand, when choosing Google Analytics, the script will inject a Google Analytics code during the redirection. Please note that some features are not available when using Google Analytics.

System analytics, when receiving high traffic, can be very resource intensive however there are tools built-in to relieve the database of old or inactive links. We recommend using a VPS. We offer managed hosting starting at $20 per month where we take care of everything.


The script nows offers caching of data. Caching is turned off by default and can be turned on via the file includes/config.php. Data is cached using phpFastCache and is stored in the tmp folder (where cookies are stored) or in the includes/library/ depending on your server configuration. It is recommended that you turn Caching off while your site is still new to provide accurate data. However once your site reaches the 100, 000 click, you should turn it On. The caching is set to 15 minutes so the same information will be displayed for users for 15 minutes. For this reason it is not recommended to use caching while your site still new and does not have to deal with a huge dataset.


This script uses some of the most advanced algorithms to keep the user account safe and your URLs phish-free. Passwords are hashed using the phpPass library which is currently one of the best solutions. All URLs go through a series of validation as stated below:

  1. URL Format
  2. CAPTCHA Check (reCpatcha V3:
  3. Bot Check
  4. Keyword Blacklisting
  5. Domain Blacklisting
  6. Google Safe Check (API required: )
  7. Phish-Tank Check (API not required but recommended because requests will limited:

Note: The password will be upgraded automatically at your first login from the old hashing algorithm. Please make sure that you use the same security key.

Google Web Risk

Google Web Risk (WR) API is now mandatory for commercial usage. The once free Google Safe Browsing API is now only allowed for personal usage. As WR is currently in beta, you will need to sign up for a beta key on this page. After you have been accepted, follow the instruction below to activate WR. Please note that Google WR requires an active billing account otherwise it will not work! A video will be uploaded very soon.

  1. Go to your Google Developer Console
  2. In side menu, click on "APIs & Services"
  4. Search for "Web Risk"
  5. The click on Enable once found
  6. Once enabled, click on the menu button at top left corner
  7. Mouse-hover on APIs and Services and in the sub-menu you will see "Credentials". Click on that.
  8. Click on "Create Credentials" and generate an "API key"
  9. Copy that API key in the script's admin panel to activate Google WR

Developer Tools & Integrations

Slack Integration

You can now integrate your app to Slack and allow users to shorten directly urls from slack. To enable Slack, please follow the instructions below.

  1. Go to Slack Developer and create or login to your account.
  2. Under Your Apps, create a new App
  3. Set a Name and choose one of your Slack Workspace for testing
  4. Under Add features and functionality, choose Create New Command
    1. Define a command
    2. In the Request URL add the following (with your own site), https://YOURSITE/webhook/slack
    3. Set a short description (this will be seen by your users)
  5. Under OAuth & Permissions, set a redirect URL which essentially your domain name.
  6. Finally, Go to Basic Information and copy your credentials to the script admin panel > settings > integrations
  7. Make sure to use the same command that you set in 4.1
  8. You can fill in the Display Information if you wish

Now your customers can directly shorten links from slack using the command and the short links will be saved in their account.

Zapier Integration

Your users can now add a Zapier Webhook to automate workflows directly from the Tools > Zapier Integration section and the script will ping the webhook with data upon new url creation or a new visit.

Social Login

The script includes authentication methods from 3 major social networks such as Google, Twitter and Facebook. Before you can use any of these, they will need to be setup. Follow the instructions below to the letter otherwise it might not work.

oAuth logins are very strict with the Callback URL. Make sure to respect the oAuth callback mentioned under each of the social network below.

Facebook Connect Video Tutorial

Users can login with their Facebook and bookmark their favorite sites. To set up your app, first go to and set up a new app by clicking "Apps". Then click "Create New App"; Facebook will ask you to configure your app. The most important fields you must fill out are App Domains and Site URL. For the oAuth Callback, add Following that Facebook will generate two keys for you. Go to the admin settings and paste those keys. That's it. If you did everything correctly Facebook connect should work.

Callback URL

Twitter Connect Video Tutorial

Users can login using twitter the same way they use facebook. You must enable twitter connect for it to appear and function. You can do that on the admin panel. You must register your website on

  1. Go to and login.
  2. Then click "Create a new application" on top right
  3. Fill the required fields, add this to the callback field:, accept the terms and conditions and click "Create your Twitter application".
  4. You will then be redirected to a page with your OAuth Settings
  5. Search & Find two keys: Consumer Key and Consumer Secret. Copy these keys and paste them in the admin settings
  6. Finally, under "settings" of your application on twitter you will see "Allow this application to be used to Sign in with Twitter". Check that and click "Update this twitter application's settings".

If you did everything correctly, Twitter OAuth should work. If it doesn't, send us an email and we will help you.

Callback URL

Google Connect Video Tutorial

Google connect protocol has been changed due to restrictions from Google. For this reason you will need to set up Google connect again. Simply follow the instructions below and it should be fairly simple.

  1. Go and login using your Google Account
  2. On the left side click "Credentials"
  3. Then click "Create new Client ID" to open the popup
  4. Select "Web Application"
  5. Add your domain name as "" under Authorized Javascript Origins
  6. Add the URI to Google Connect under Authorized Redirect URI as
  7. Generate a public key and client secret and add those in the admin panel

Callback URL


This script now offers a membership system where users can upgrade their account for a fee to use some pro features such as the custom splash page. The features that are only available to pro users are custom splash page, ability to choose the redirection type, ability to use premium aliases (set by admin), no advertisement side-wide. The fees are set via the admin panel and discounts are calculated manually. You will need to activate IPN in your PayPal account and use the following URL as the IPN receiver: (if you have SSL enabled make sure to use https).

For PayPal, make sure the option "Block Non-encrypted Website Payment" is turned OFF.

  1. Login to your PayPal account
  2. Profile > Profile and Settings
  3. Click on Website Payment Preferences
  4. Search for Encrypted Website Payments
  5. Change the settings Block Non-encrypted Website Payment from ON to OFF.

For Stripe, please check below for instructions on how to set it up.

Once the user clicks upgrade on top, the system will redirect to the upgrade page and will offer the plans set in the admin panel in either monthly and yearly. They will then be redirect to PayPal where they can login to pay or be able to checkout directly on the site when Stripe is enabled. Once the payment has been made, the user will be redirected back and the changes will be made to the account.


The system will automatically switch the user from Pro to Free if the account has not been renewed. This will also temporarily disable all custom splash pages. Since a subscription system is currently unavailable, the user will need to renew the account every month or opt-in for the yearly plan.


Version 5.3 adds custom plans where you can choose the different options for each plan. You can even add a free plan which will be associated to free users upon registration. You can choose the plan title, description, prices (monthly and yearly), and add different restrictions such as limited splash pages or custom domain names.

If you don't plan to offer a free plan, users will be forced to upgrade to a plan after registration.

If you are using Stripe, you need to add your API keys before creating plans otherwise the script will not create plans on Stripe.


Version 5.8 adds the possibility to add coupon and have users redeem them. You can easily add a coupon via the admin panel. At this moment coupons can only be added when you have Stripe enabled. By default, the discount on the plan via the coupon is applied for a maximum of 12 months and the subscription will be switched to the full price after.


Version 5.8 adds the possibility to add a trial to each paid plan. Trials are automatically applied without the need for a credit card. After the trial expires, the user will be switched to a free plan if available or be forced to upgrade. Users can upgrade at any time during their trial period.


Version 5.0 has Stripe built-in. This will allow to painlessly subscribe customers and charge them automatically. Everything will be managed by the script. This means payments, subscriptions, cancellation and refunds are managed so you don't have to worry. A video will be online soon to explain on how to activate Stripe. Meanwhile you can use the instructions below.

Please note that subscription requires an Extended License.

Activating Subscription

  1. Login to the admin
  2. Go to the subscription tab
  3. Enter your extended purchase code to activate it

Setting up Stripe

  1. Create a free stripe account
  2. Activate your stripe account
  3. Go to the API tab
  4. Generate a Publishable key
  5. Generate a Secret key
  6. Then go to Webhooks
  7. Click on Add endpoint
  8. In the "URL to be called section", add
  9. Select "Charge" events
  10. Once your webhook is created, click on that
  11. Then at the bottom you will see a "Signing secret" block. It starts with whsec_
  12. Add your Keys and your Signing secret key in the admin panel to activate subscription.
  13. If you already have plans created, you will have to delete them and create new plans so it can sync with Stripe.

Domain Name Management

This script supports addition of multiple domain names. Addon domains can either be added by the owner of the site via the admin (via Multiple Domains feature) or by the customer if the customer wishes to use their own domain name (via Custom Domain feature). Getting domain names to work is somewhat tricky might not work on all type of server (especially shared servers) without some changes to the virtual host file.

Multiple Domains

You can enable the multiple domains feature if you have more than one domain name. You will allow your users to choose or set a domain name by default. To add your domain names, simply fill the box in the admin section and add one domain name per line including http:// or https://. To set up your domain name, add your domain name to your server and forward all requests to your main using the following code.

Shared Server/cPanel

If you are on a shared server, you will have to add the domain name via the "Addon Domain" tool located in cPanel. It is very important that the Root Directory of the domain be the same as the primary domain or where the script has been installed.

VPS/Dedicated Server

If you are on a dedicated server, you will need to do a small modification to the default apache conf file usually located in /etc/apache2/sites-enabled/ and named 000-default.conf. Open that file and you will see the content showed on the right. You will need to replace the path /var/www/html/ in DocumentRoot and Directory to the path where the script is installed and restart Apache.

To check if the domain name is working, after visiting the domain you should get a page with a message that says Yes. Your domain name is working. Add it to your account now. If you get any other page, that means the server is handling the domain name and is pointing it to another page.

 <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.cgi index.html index.xhtml index.htm


Custom Domains Video Tutorial

Customers can add their own domain name and use it to shorten URLs. This will require some setup. First, as admin, you need to enable Multiple Domain Names in the admin panel > settings > advanced settings. Once that is done, your customers can add their own domain name via the Custom Domain page. They will need to either add an A record or a CNAME record. On your side, you will require some changes before your server can accept their domains.

Shared Server/cPanel

If you are on a shared server, you will have to add the domain name via the "Addon Domain" tool located in cPanel. It is very important that the Root Directory of the domain be the same as the primary domain or where the script has been installed.

VPS/Dedicated Server

If you are on a dedicated server, you will need to do a small modification to the default apache conf file usually located in /etc/apache2/sites-enabled/ and named 000-default.conf. Open that file and you will see the content showed on the right. You will need to replace the path /var/www/html/ in DocumentRoot and Directory to the path where the script is installed and restart Apache.

To check if the domain name is working, after visiting the domain you should get a page with a message that says Yes. Your domain name is working. Add it to your account now. If you get any other page, that means the server is handling the domain name and is pointing it to another page.

 <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.cgi index.html index.xhtml index.htm