GeoShortURL
June 1, 2024 ยท View on GitHub
This YOURLS plugin enables the possibility to have different redirection URLs depending on the country of the visitor, by using YOURLS GeoIP plugin or by using the web server's built-in GeoIP module.
It is strongly recommended to use this plugin along with 302-instead plugin to avoid the 301 caching hell :)
Usage:
For any given short URL you need to 'Geoize' (e.g: http : //my-yourls-installation/blah):
- use it to create a new short URL with the desired country code suffix (e.g. for France : blah-fr)
- assign it with your country-specific long URL
How to install this plugin
- Create a new directory under the "user/plugins" directory
- Save the "plugin.php" file into the directory you created in step 1
- Activate the plugin using your YOURLS admin panel
Activate conditional redirection for a set of locales
Given the following long URLs:
https://blah.something/product/product-aThis is the default page in Englishhttps://blah.something/ru/product/product-aThis is a Russian pagehttps://blah.something/fr/product/product-aThis is a French page
- Create links in the admin panel, you need to add short URLs like
https://my-yourls-installation/aforhttps://blah.something/product/product-ahttps://my-yourls-installation/a-ruforhttps://blah.something/ru/product/product-ahttps://my-yourls-installation/a-frforhttps://blah.something/fr/product/product-a
- Share
After that, you just need to share
https://my-yourls-installation/awith others, It will automatically detect and matchmy-yourls-installation/a-[geocode]to redirect to the corresponding locale page or just go to the default (English) page.