Setup

Setting up YOURLS

What's Needed

Well first you need a domain and a webhost. You also need a MySQL database for YOURLS to store the shortened link data. YOURLS will automatically make a prefix in the database. A webhost normally supplies this for you. For this tutorial, I am going to use a self hosted webhost. At this point, it is assumed that you know how to point your webhost's DNS name servers to a domain and how to copy/modify files over to a webhost (via FTP).

Preparations

You need to download a copy of YOURLS from here. After you downloaded it, extract the .zip. Upload the extracted files to your website. I prefer to use FileZilla to upload files to a webhost. Note: If the domain you are using is not dedicated to YOURLS, you should create a folder called yourls under your main directory. If you don't YOURLS might conflict with other files that might be installed on your host. Like a forum.

Editing the config

Once you have a copy of YOURLS installed on your server, you then want to rename config-sample.php to config.php. This is found in the directory, User. Once you have renamed it, open it up with any text editor. Notepad(plus plus) works best, but you could also use the editor used by your webhosts built in FTP browser. Once you have it open, we are going to need to fill in some required info.

Database options

  • YOURLS_DB_USER (This is your MySQL Database username. Your webhost should give you this information)
  • YOURLS_DB_PASS (Your database password)
  • YOURLS_DB_NAME (The name of your database. Your host should give you this)
  • YOURLS_DB_HOST (The host of your database. Normally, it is localhost, but your webhost might use something else)
  • YOURLS_DB_PREFIX (You can keep this value the same. Unless you want to change it)

Site options

  • YOURLS_SITE (Where you installed your copy of YOURLS. If you installed it in a folder that is NOT the root directory, make sure you put that in with no trailing slash)
  • YOURLS_HOURS_OFFSET (The current time zone you are in)
  • YOURLS_UNIQUE_URLS (Just leave this as true)
  • YOURLS_PRIVATE (I would highly recommend that you DO NOT change this value. It will cause security issues.)
  • YOURLS_COOKIEKEY (Make this anything. Literally anything. It doesn't matter.)
  • $yourls_user_passwords
    • Make sure you change this. If you don't plan on having another user, delete username2 and password2 and the ","(comma) that is at the end of the first username and password.

URL Shortening Settings

  • YOURLS_URL_CONVERT
    • 36: generates all lowercase keywords (ie: 13jkm)
    • 62: generates mixed case keywords (ie: 13jKm or 13JKm)
    • Stick to one setting. It's best not to change after you've started creating links.
  • $yourls_reserved_URL (Anything in here will not be created as a short URL name.)

Finishing Installation

After you have edited the config to your liking, point your browser to where you installed YOURLS, and then put /admin at the end. Log in using your username and password as defined in the config and then you are done!

Plugins

If you want your URL's to be like what they are with bit.ly or anything like that, then you need to install a plugin. The one plugin that I would reccomend that you install would be this one. You can see a list of plugins here

Setting up ShortIt's Config

After you have YOURLS setup, all you need to do is find out what your API link is, which is very easy. So your api link is located in whatever directory you have it installed. But before we make our link, we first need to find our "signature". Instead of putting your username and password in our API link, we can put a signature in it so that it is more secure. To find your signature, go to your admin area and click on "tools". Scroll down to Secure passwordless API call and look for "Your secret signature token:". This is your "signature".

So your API link will be [yourdomainname]/yourls-api.php?signature=[your signature]&action=shorturl&url=

This is exactly what you put into the config. Don't change anything else but your signature and your domain name/folder or else the plugin will not work.

If something doesn't work, post a comment and I will try to fix it for you.


Comments

Posts Quoted:
Reply
Clear All Quotes