A YOURLS plugin that truly allows creating multiple short URLs with different keywords for the same destination URL.
Author: Martin Kessler
By default, YOURLS enforces URL uniqueness with the YOURLS_UNIQUE_URLS=true
configuration. The "Allow Existing URLs" plugin modifies the API response to return success and the existing URL but doesn't actually create multiple short URLs.
This plugin goes further by completely bypassing the uniqueness check when requested, allowing you to create multiple different short URLs that point to the same destination URL.
- Download the plugin files
- Copy the
force-allow-duplicates
folder to yourYOURLS/user/plugins/
directory - Activate the plugin in your YOURLS admin interface
- No configuration required
To create multiple short URLs for the same destination, add force=1
to your API request:
https://yourdomain.com/yourls-api.php?action=shorturl&url=https://example.com&keyword=example1&force=1
Then later:
https://yourdomain.com/yourls-api.php?action=shorturl&url=https://example.com&keyword=example2&force=1
Both requests will successfully create different short URLs pointing to the same destination.
When force=1
is not specified, the plugin falls back to the original "Allow Existing URLs" behavior, returning success but with the existing URL rather than creating a duplicate.
This plugin:
- Hooks into the
url_exists
filter to bypass the uniqueness check whenforce=1
is set - Uses the
shunt_add_new_link
filter to directly add the URL to the database, bypassing the normal constraints - Maintains the original "Allow Existing URLs" functionality as a fallback
- YOURLS 1.8+
- May not be compatible with some plugins that rely on URL uniqueness
This plugin is part of the YOURLS-MCP project, which enables integration between YOURLS and Claude Desktop via the Model Context Protocol (MCP).
For issues, feature requests, or support, please use the GitHub issue tracker.
MIT