Download the PHP package in2code/ipandlanguageredirect without Composer
On this page you can find all versions of the php package in2code/ipandlanguageredirect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download in2code/ipandlanguageredirect
More information about in2code/ipandlanguageredirect
Files in in2code/ipandlanguageredirect
Package ipandlanguageredirect
Short Description Redirects TYPO3 visitors automatic or with a suggestlink to another language and/or root page.
License GPL-2.0-or-later
Homepage https://github.com/einpraegsam/ipandlanguageredirect
Informations about the package ipandlanguageredirect
TYPO3 Extension ipandlanguageredirect
TYPO3 FE visitor automatic or manual redirect to another language or another root page.
Introduction
This extension allows multi-language and multi-domain handling with redirects to best fitting pages with best fitting language based on the visitors browser language and region (IP-Address).
An AJAX-request (VanillaJS only - no JavaScript framework is needed) will handle the serverside-domain-logic to redirect or suggest a new webpage or a new language.
Define in your PHP-configuration which countries belongs to which pagetree and which browserlanguage belongs to which frontend language
In short words
Automaticly redirect or show a note for the visitor to give him the best fitting website version for his/her needs.
Screens
Example suggest message in frontend:
Which way is used to get the country code of the user?
This is completely your choice now. You can choose between different ip2country service classes. There is a local table with ip-ranges and countries on the one hand and on the other hand, you can also use external services to convert the visitors ip to a countryCode. While the first methods respects all privacy the second method is more current of course.
Or: You can combine different methods: Because the service of IpApi is for free for 1000 requests a month, you can use this and in addition the offline-table variant.
Available classes per default:
In2code\Ipandlanguageredirect\Domain\Service\IpToCountry\IpApi
- This uses the external service of ipapi.co to convert IP-addresses to a country code. Note: You can set the api key via TypoScript if you want to use more then 1000 requests a monthIn2code\Ipandlanguageredirect\Domain\Service\IpToCountry\LocalDatabase
- This uses the local database tabletx_ipandlanguageredirect_domain_model_iptocountry
to convert the ip address to a country - no external service, most privacyIn2code\Ipandlanguageredirect\Domain\Service\IpToCountry\IpApiCom
- This uses the external service of ip-api.com to convert IP-addresses to a country code. Attention: Because https is not possible by this service all request are handled over port 80
Go to the extension manager settings and choose the classes that you want to use or simply add your own service. Example
string in the extension manager settings for ipToCountryService
could be
In2code\Ipandlanguageredirect\Domain\Service\IpToCountry\IpApi,In2code\Ipandlanguageredirect\Domain\Service\IpToCountry\LocalDatabase
to use the service of IpApi as long as it is free and then fall back to the local database.
What's the difference to other extensions like rmpl_language_detect?
There is a basic difference in the concept. While most of the language-redirect extensions hook into the page rendering process via USER_INT, we choose an ansynchronical way with JavaScript and PHP (AJAX). This solution needs JavaScript on the one hand but is much faster for high availability and more complex websites on the other hand. This means: You can use e.g. staticfilecache or another static solution to improve web performance. While it's not possible to use staticfilecache with a USER_INT, which is included on every single page.
Testing!
This extension allows you to test how your website will react if a visitor from a different country checks out your website. See below for a lot of testings possibilities.
Installation
- Install this extension
- Add a static template (page.5 will be used for the suggest container, page.1555 for the script)
- Copy the original configuration from ipandlanguageredirect/Configuration/Redirect/Redirect.php to any other location
- Modify the configuration for your needs
- Set the new path in the extension manager to your configuration file
- Have fun!
Example configuration
TypoScript
If you add the static TypoScript, this lines have an effect:
Testing
Simulate browserlanguage, country and referrer
Note: Be aware that this settings are cached by default. So you have to always add a &no_cache=1
Don't redirect or suggest but show the redirectUri in the browserconsole
Example answer from your server:
FAQ
- Hide Suggest Message
- Q1: How to disable the suggest message on click on one of my own links?
- A1: You could add links or other dom elements with attribute data-ipandlanguageredirect-action="hideMessage" anywhere on your page to disable the suggest message. Use case: If the user changes the region or language manually on your site, the message should be dissapear in future.
- Q2: How to disable the suggest message with a GET parameter?
- A2: The message will be hidden and the cookie to hide it will be set if the GET parameter &h=1 or &h=3 is given
- Disable redirect
- Q1: How to disable the redirect on click on one of my own links?
- A1: You could add links or other dom elements with attribute data-ipandlanguageredirect-action="disableRedirect" anywhere on your page to disable redirect.
- Q2: How to disable the redirect with a GET parameter?
- A2: The redirect will be disabled by settings a cookie if the GET parameter &h=2 or &h=3 is given
- Cookie Livetime
- The default cookie livetime is temporarely - as long as the browser is open. This is not adjustable at the moment.
- Testing
- Q1: How can I test another IP-address, region or browserlanguage?
- A1: See part testing
- Q2: Where can I see which parameters are send and received via AJAX?
- A2: Open your browser console and check the post request to ?type=1555 - check the parameters or answers
- Typenum will not work
- Q1: In TYPO3 9 or higher my requests won't work - what can I do?
- Q1: You have to define the used type param in your routing configuration (see following example)
Routing example:
Your Contribution
Pull requests are welcome in general! Nevertheless please don't forget to add a description to your pull requests. This is very helpful to understand what kind of issue the PR is going to solve.
- Bugfixes: Please describe what kind of bug your fix solve and give me feedback how to reproduce the issue. I'm going to accept only bugfixes if I can reproduce the issue.
- Features: Not every feature is relevant for the bulk of extension users. Please discuss a new feature before.
Contribution with ddev
Requirements
- Install ddev, see: https://ddev.readthedocs.io/en/stable/#installation
- Install git-lfs, see: https://git-lfs.github.com/
Installation
- Clone this repository
- Run
ddev start
- Run
ddev initialize
to setup configurations and test database
What's not (yet?) possible at the moment
- Make wildcard usage available in browserlanguage (like "en*" for all english browserlanguages)
- Support all browserlanguages and not only the first one
- Support also continents
Changelog
Version | Date | State | Description | Note |
---|---|---|---|---|
5.2.1 | 2023-04-23 | Bugfix | Bugfix for correct constraints | |
5.2.0 | 2023-04-20 | Feabure | Support for TYPO3 12 | |
5.1.2 | 2023-06-12 | Security | Fix a possible SQL injection | |
5.1.1 | 2023-02-07 | Bugfix | Fixed undefined array key exception in PHP 8 | |
5.1.0 | 2022-07-12 | Task | Css and frontend toolchain update | |
5.0.0 | 2022-04-08 | Task | Update for TYPO3 11 (9 and 10 support is dropped now) | |
4.0.1 | 2021-11-22 | Task | Define extension key in composer.json file | |
4.0.0 | 2020-12-31 | Task | Update for TYPO3 9 and 10 | |
3.1.0 | 2020-02-07 | Task | Small update: Move ext icon to Public, clean composer.json, doc update | |
3.0.1 | 2019-08-06 | Bugfix | Don't use a configuration of a wrong rootpage | |
3.0.0 !!! | 2019-07-05 | Feature | Do actions based on user agent (disable redirect for google page speed) | Update your configuration |
2.2.0 | 2019-04-26 | Task | Support language handling in TYPO3 9, small documentation fixes | |
2.1.0 | 2019-01-10 | Task | Small cleanup, small text changes | |
2.0.0 !!! | 2018-10-18 | Feature | Multi domain handling, actionOnHomeOnly, offline ip2geo, stayOnCurrentPage | Update your configuration |
1.8.0 | 2018-08-23 | Task | Add extension icon, add some documentation | |
1.7.2 | 2018-01-21 | Task | Allow ipapi key now without &key= | |
1.7.1 | 2018-01-16 | Bugfix | Don't send "null" for an IP-address value if not testvalue is given | |
1.7.0 | 2017-09-25 | Feature | Support paid variant of IpApi.co for more then 1000 visitors a day | |
1.6.4 | 2017-08-11 | Bugfix | Fix header output in TYPO3 8 | |
1.6.3 | 2017-07-28 | Bugfix | Disable cHash check for AJAX requests in T3 8 | |
1.6.2 | 2017-07-12 | Bugfix | Fix small typo in composer.json | |
1.6.1 | 2017-04-12 | Bugfix | Fix getting browserlanguage from chrome | |
1.6.0 | 2017-02-04 | Feature | Redirection should be only once in a session | |
1.5.3 | 2017-02-01 | Bugfix | Make code readable for PHP 5.5 | |
1.5.2 | 2017-01-31 | Task | Remove unused typoscript | |
1.5.1 | 2017-01-26 | Bugfix | Avoid JS exception if state == none | |
1.5.0 | 2017-01-25 | Feature | New option to disable functions for a pagetree | |
1.4.1 | 2016-11-15 | Task | Semantic code cleanup for HTML and CSS | |
1.4.0 | 2016-11-15 | Feature | Semantic code cleanup for HTML and CSS | |
1.3.0 | 2016-11-07 | Feature | Hide suggest message on GET parameter | |
1.2.0 | 2016-11-03 | Feature | Allow hideMessage on multi-links now | |
1.1.0 | 2016-11-01 | Feature | Add testing features | |
1.0.0 | 2016-11-01 | Initial | Initial release |