Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/pdclark/safe-redirect-short-urls/archive/refs/heads/master.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Turns Safe Redirect Manager into a Short URL service.
Setup
- Activate the plugin. It will auto-activate Safe Redirect Manager or request it be installed if it doesn't exist.
- Add
define( 'SHORT_URL_API_KEY', 'YOUR-API-KEY' );towp-config.php.
Generate a short URL:
Example request:
Example return:
Options
Override the default domain name. For example, if you have a short domain that also points to your site.
add_filter( 'srsu_site_url', function(){ return 'http://pd.cm'; } );
Set the API key using a filter. Useful for setting config in an mu-plugin instead of wp-config.php
add_filter( 'srsu_api_key', function(){ return 'kckRse'; } );
Details
- URL keys are Hash IDs based on the ID used for the redirect custom post type.
- Hash IDs are salted, causing them to not be easily guessed.
- Redirects are checked for duplicates. If a duplicate is found, the original Hash ID is returned.
- Hash IDs have no possibility for intersections -- every ID will be unique.
- Hash IDs will be as short as possible for the given post ID and salt.