tobozo / YOURLS-GeoShortURL

🔗 YOURLS plugin to add per-country support to existing short URLs
MIT License
7 stars 2 forks source link

The Geo-Redirect does not work after installation #4

Closed dhuettner closed 2 years ago

dhuettner commented 2 years ago

I have installed and activated the plugin as described. Additionally as already described the plugin "Allow Hyphens in Short URLs" and the plugin "Geo API plugin" from alexjakass.

For the GeoIP Redirect Redirection Rules: Inherit Country code from YOURLS GeoIP plugin

Then with a URL deposited:

https://yourls.digitalfairydust.dev/bosch = https://www.bosch.de/

and for each language a language suffix

https://yourls.digitalfairydust.dev/bosch-en (https://www.bosch-home.nl/) https://yourls.digitalfairydust.dev/bosch-nl (https://www.bosch-home.com/us/) https://yourls.digitalfairydust.dev/bosch-de (https://www.bosch.de/unser-unternehmen/bosch-in-deutschland/#standorte)

Unfortunately, I always end up on the same default page: "https://www.bosch.de/".

I tested the whole thing using NordVPN and also by changing the language of the browser.

Can you support here or tell me if I'm doing something wrong?

tobozo commented 2 years ago

hey @dhuettner thanks for your feedback

This plugin can take advantage of yourls_geo_ip_to_countrycode() builtin function based on php_geoip, or HTTP_X_GEOIP_COUNTRY_CODE nginx server variable, depending on the choice in the setup panel.

I'd start checking the geoip configuration to make sure the geoip database is up to date, and the IP addresses from your VPNs are correctly listing the country code you're expecting.

phpinfo() should be enough of a test to confirm the availability of the geoip module, or show the server variable.

[edit] guessing country from browser language is a trap, the relation between language and country is not mutually exclusive (e.g. I'm in France using US locales on my system with an en-GB keyboard layout, so only my IP Address should matter).

dhuettner commented 2 years ago

@tobozo

thank you for your information. It put me on the right track and I was able to locate the error. 

In this environment, the plugin "Geo API plugin" https://github.com/ssecurelabs/yourls-Geo-API-plugin was still active, which is why the whole thing did not work properly. After I had deactivated the plugin and have made a refresh now everything plays as you have described it.

Many thanks for it.