Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Tips and must-do things if you run a public shortening interface.
Want to run your own little bitly? You need what is called a public interface along with your private YOURLS install. Make sure you read Private Or Public first.
A sample public interface is provided, named
sample-public-front-page.txt. Rename it as a
.php file and customize it to suit your needs.
You will find examples and inspiration in the More / Showcase section of the
Similarly, you can run a public API with a private install. There is also a sample file provided, named
If you run a public interface, you will have to deal with spam and if you're not prepared, your webhost will not like it and eventually shut your account down.
Out of the box, YOURLS 1.6+ allows URLs with common protocols such as
facetime://. See Custom Protocols for more info.
This is neat if you trust users, this is most likely unwanted if anyone can shorten links. It is easy to define what protocols will be allowed:
To globally enforce a custom set of allowed protocols and blacklist all others, just add the following at the end of your
$yourls_allowedprotocols = array( 'http://', 'https://', 'facetime://' );
Depending on the user and context
To contextually enforce depending on the user (logged in or not), use a plugin such as Custom Protocols
Often asked is the question about the kind of webhost and server you need to run your public interface. There is no short answer: it completely depends on traffic & usage you expect.
YOURLS itself isn't much of a resource eater. The CPU load is virtually null and a redirection costs nothing. There's only a small SQL cost: each redirection generates 2
read queries and 2
write queries. Use these numbers to estimate what your web hosting is capable of.
If you need further tweaking, you can install cache plugins or disable the logging - read the README.