Skip to content

A YOURLS plugin that truly allows creating multiple short URLs with different keywords for the same destination URL

License

Notifications You must be signed in to change notification settings

kesslerio/yourls-force-allow-duplicates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Force Allow Duplicate URLs

A YOURLS plugin that truly allows creating multiple short URLs with different keywords for the same destination URL.

Author: Martin Kessler

Description

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.

Installation

  1. Download the plugin files
  2. Copy the force-allow-duplicates folder to your YOURLS/user/plugins/ directory
  3. Activate the plugin in your YOURLS admin interface
  4. No configuration required

Usage

API Usage

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.

Fallback Behavior

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.

How It Works

This plugin:

  1. Hooks into the url_exists filter to bypass the uniqueness check when force=1 is set
  2. Uses the shunt_add_new_link filter to directly add the URL to the database, bypassing the normal constraints
  3. Maintains the original "Allow Existing URLs" functionality as a fallback

Compatibility

  • YOURLS 1.8+
  • May not be compatible with some plugins that rely on URL uniqueness

Related Projects

This plugin is part of the YOURLS-MCP project, which enables integration between YOURLS and Claude Desktop via the Model Context Protocol (MCP).

Support and Issues

For issues, feature requests, or support, please use the GitHub issue tracker.

License

MIT

About

A YOURLS plugin that truly allows creating multiple short URLs with different keywords for the same destination URL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages