FriendsOfREDAXO / FriendsOfREDAXO/tricks
Session Cookie immer für Hauptdomain ohne www
- Dominant language
- SCSS
- Stars
- 112
- Forks
- 31
- Avg merge
- 23h 3m
- Merged PRs (30d)
- 3
Description
Wenn man das Session Cookie immer für die Hauptdomain ohne www (.domain.de) setzen lassen will, ist folgender Code sinnvoll.
**Ein Use-Case:**
Nutzer loggt sich via yCom Addon auf www.domain.de/login ein und soll nach erfolgreichem Login auf subdomain.domain.de umgeleitet werden, dort ist der Nutzer dann immer noch eingeloggt. Die Subdomain ist in diesem Fall auch eine eigene Domain in der Redaxo Instanz.
```
rex_extension::register('PACKAGES_INCLUDED', function () {
$host = rex_server('HTTP_HOST', 'string', '');
$bareHost = preg_replace('/^www\./i', '', $host);
$sessionConfig = rex::getProperty('session', []);
$sessionConfig['frontend']['cookie']['domain'] = '.' . $bareHost;
rex::setProperty('session', $sessionConfig);
}, rex_extension::EARLY);
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the issue body and review the provided PHP snippet and its www-to-subdomain login use case. Add this as a REDAXO trick in the repository’s existing documentation or content structure, preserving the example and explaining the intended session-cookie behavior. Done means the trick is published in the appropriate format and remains understandable to users.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 78/100