YOURLS
Your Own URL Shortener: open-source link shortener and self-hosted alternative to Bitly.
Why consider YOURLS?
YOURLS is an open-source PHP link shortener that runs on your own domain. It provides custom keyword slugs, click tracking analytics, referrers geolocation, and full plugin support.
Learn YOURLS by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide10 sections
What is YOURLS?
YOURLS (Your Own URL Shortener) is an open-source web application written in PHP and MySQL that lets you run your own private or public link shortening service on custom branded domains. It serves as a self-hosted alternative to commercial link shorteners like Bitly, TinyURL, and Rebrandly.
YOURLS gives you full control over short URLs: customize keyword slugs, track detailed click analytics and referrer sources, restrict access to authorized team members, and extend capabilities using a rich library of community plugins and REST APIs.
Who Is It For?
- Marketing Teams & Content Creators: Creating branded short links (e.g.
go.brand.com/summer-sale) that maintain brand recognition on social media and email campaigns. - Enterprise Organizations: Shortening internal corporate URLs while keeping link analytics and destination data strictly inside private network domains.
- Web Developers: Integrating automated programmatic short link creation into mobile apps, web backends, and Slack bots via REST APIs.
Key Features
- Custom branded short links: Choose custom keyword slugs or generate sequential/random short strings.
- Comprehensive link analytics: Track total clicks, referrers, visitor countries, and historical traffic graphs.
- Full REST API with secret signature token authentication for programmatic link creation and retrieval.
- Powerful plugin architecture supporting custom authentication, anti-spam, QR codes, and caching.
- Password-protected administrative dashboard with public or private access modes.
Deploying YOURLS with Docker Compose
version: '3.5'services: yourls: image: yourls:latest container_name: yourls restart: unless-stopped ports: - "8080:80" environment: - YOURLS_DB_HOST=db - YOURLS_DB_NAME=yourls - YOURLS_DB_USER=yourls - YOURLS_DB_PASS=secure_yourls_pass - YOURLS_SITE=http://localhost:8080 - YOURLS_USER=admin - YOURLS_PASS=secure_admin_password - YOURLS_SECRET=generate_a_secure_random_hash_token_string depends_on: - db db: image: mariadb:10.11 container_name: yourls_db restart: unless-stopped volumes: - ./mysql_data:/var/lib/mysql environment: - MARIADB_DATABASE=yourls - MARIADB_USER=yourls - MARIADB_PASSWORD=secure_yourls_pass - MARIADB_ROOT_PASSWORD=root_secure_passwordStart the instance:
docker compose up -dOpen http://localhost:8080/admin/ in your browser to complete one-click database table creation and begin generating short links.
Practical Use Cases
1. Branded Marketing Campaigns
A marketing team generates custom campaign short links (link.brand.com/launch) for printed billboards and social ads, tracking total scans and geo-location conversion rates.
2. Programmatic API Integration
An e-commerce order confirmation backend calls the YOURLS API via cURL to generate unique tracking links sent to customers via SMS.
3. QR Code Generation for Events
An event organizer installs the official YOURLS QR Code plugin to automatically generate high-resolution QR codes alongside each short link for printed badges.
Troubleshooting and Limitations
- Web Server URL Rewriting (mod_rewrite): YOURLS requires Apache
mod_rewrite(or Nginxtry_files) enabled to route short URLs toyourls-loader.php. - Public Domain Configuration: Ensure
YOURLS_SITEmatches your exact external public URL (including protocol and port) to ensure generated short links resolve accurately.
Official Resources
- Official Website: https://yourls.org
- GitHub Repository: https://github.com/YOURLS/YOURLS
- Documentation: https://yourls.org/docs/
Related tools
More options with a similar category or technology profile.
McFly
Fly through your shell history with an intelligent neural network search engine.
cheat
Interactive command-line cheatsheets for system administrators and software engineers.
Pipenv
Python development workflow for humans uniting Pipfile, pip, and virtualenv.
Rye
Comprehensive Python package and workspace management tool written in Rust.