realurl
realurl copied to clipboard
chash cache doesn't take take root page into account
Summary
The internal chash cache (database table tx_realurl_chashcache) maps a given combination of query string and query parameters to a single chash value. It's intended to not recalculate chashe values when resolving GETvars from SEO URLs but to just look them up.
This can conflicts when common non-page records should be displayed on different detail pages on different root pages that share the same language and by accident the same page path to the detail page.
Example
Given a page tree like this:
- first-domain [1]
- new-details [2]
- second-domain [3]
- news-details [4]
Given a news record "testnews" with News-ID 10.
The news record is to be shared across both root pages.
There are two URLs to the same news record:
Encoded URL | Decoded URL |
---|---|
https://first-domain/news-details/testnews | index.php?id=2&news=10&chash=foo |
https://second-domain/news-details/testnews | index.php=id=4&news=10&chash=bar |
Expected
The database table tx_realurl_chashcache should look like this:
spurl_hash | chash_string | spurl_string |
---|---|---|
aaaaa | foo | first-domain/news-details/testnews |
bbbbb | bar | second-domain/news-details/testnews |
Actual behavior
The database table tx_realurl_chashcache looks like this:
spurl_hash | chash_string | spurl_string |
---|---|---|
bbbbb | bar | news-details/testnews |
Solution
There's the \Tx\Realurl\Hooks\UrlRewritingHook::$additionalParametersForChash
.
This can be used to add the current hostname to the chash cache.