/redaxo-yrewrite:yrewrite-domainsfrom redaxo-yrewrite
Configures YRewrite domains in REDAXO: maps hostnames to category trees, manages multi-language sites, and generates URLs via rex_yrewrite helpers. Useful for multi-domain setups, internal link generation, and URL routing troubleshooting.
Ships in redaxo-yrewrite. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
YRewrite ties hostnames (like www.example.com, example.de, en.example.com) to a "mount category" in the article structure. Each domain can be limited to a subset of languages (clangs) and have its own start article, 404 article, and sitemap.
Domains are configured in the backend (YRewrite → Domains) and stored in the table rex::getTable('yrewrite_domain') (alias domains in rex::getTable('yrewrite_alias')). rex_yrewrite::generateConfig() compiles them into the cache file rex_path::addonCache('yrewrite', 'config.php'), which is what rex_yrewrite reads at runtime; the backend calls rex_yrewrite::deleteCache() after every change. Code can read them but typically doesn't write them.
Programmatic access:
$current = rex_yrewrite::getCurrentDomain();
echo $current->getName(); // 'www.example.com'
echo $current->getMountId(); // mount category ID
echo $current->getStartId(); // start article ID for this domain
echo $current->getNotfoundId(); // 404 article ID
echo $current->getStartClang(); // default language ID
$all = rex_yrewrite::getDomains(); // all domains by name
$de = rex_yrewrite::getDomainByName('www.example.de');
Always use YRewrite's helpers – never construct URLs by hand. The helpers know about domains, language slugs, and pretty paths.
// Full URL including scheme and domain
$url = rex_yrewrite::getFullUrlByArticleId($articleId, $clangId);
// Core function; YRewrite generates the URL via the URL_REWRITE extension point.
// Path if the article belongs to the domain of the current host (or to no configured domain),
// otherwise the full URL of the article's domain.
$url = rex_getUrl($articleId, $clangId);
Use getFullUrlByArticleId() for anything that leaves the page (canonical tags, og:url, hreflang alternates, sitemap entries, email confirmations). Use rex_getUrl() for in-page links – there is no separate path-only helper.
getFullUrlByArticleId($id, $clang, $params, $separator) joins query parameters with & by default. That is right for HTML output; for a Location header, JSON, or a value you escape afterwards pass '&', otherwise rex_escape() produces &.
Each domain maps to one or more languages. The default language usually has no path prefix; alternate languages get a prefix matching their code (e.g. /en/about, /fr/about).
foreach (rex_clang::getAll(true) as $clang) {
if (!in_array($clang->getId(), rex_yrewrite::getCurrentDomain()->getClangs(), true)) {
continue;
}
$url = rex_yrewrite::getFullUrlByArticleId(
rex_article::getCurrentId(),
$clang->getId()
);
echo '<link rel="alternate" hreflang="' . $clang->getCode() . '" href="' . rex_escape($url, 'url') . '">';
}
Add a self-referencing canonical with the current language's code as well, plus an x-default:
$defaultClang = rex_yrewrite::getCurrentDomain()->getStartClang();
$defaultUrl = rex_yrewrite::getFullUrlByArticleId(rex_article::getCurrentId(), $defaultClang);
echo '<link rel="alternate" hreflang="x-default" href="' . rex_escape($defaultUrl, 'url') . '">';
if (rex_yrewrite::getCurrentDomain()->getName() === 'shop.example.com') {
// shop-specific frontend logic
}
For language-prefix detection, prefer rex_clang::getCurrentId() over parsing the URL yourself.
Generally you stay on whichever domain the user requested. If you need to redirect across domains:
$other = rex_yrewrite::getDomainByName('en.example.com');
if ($other) {
$url = rex_yrewrite::getFullUrlByArticleId(
$articleId,
$other->getStartClang()
);
rex_response::sendRedirect($url, 302);
}
rex::getServer() . '/' . $path – ignores domain mappings, hreflang prefixes, and per-domain start articles.rex_getUrl() and copy-pasting the result somewhere external – it's a relative path whenever the article belongs to the domain of the current host, and a full URL only for articles of another domain. Use rex_yrewrite::getFullUrlByArticleId() for anything that leaves the page.rex_clang::get($id)->getCode()./etc/hosts entries – YRewrite picks the wrong domain and routing silently goes to the default.rex_yrewrite::getHost() as a trust anchor – it returns $_SERVER['HTTP_X_FORWARDED_HOST'] or HTTP_HOST, a header the caller controls, so comparing a redirect target against it proves nothing. Use rex_yrewrite::getCurrentDomain()?->getHost(), which comes from the configured domain.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub friendsofredaxo/claude-marketplace --plugin redaxo-yrewrite3 skills in this plugin
/yrewrite-redirectsConfiguring redirects and forwards in YRewrite – internal redirects via rex_yrewrite_forward, .htaccess rules, choosing between 301 and 302. Use when the user sets up URL redirects, migrates URLs from a previous site, handles 404s, or fixes broken external links./yrewrite-seoSEO helpers in YRewrite – meta tags via rex_yrewrite_seo, sitemap.xml generation, robots.txt, canonical and hreflang tags. Use when the user adds SEO meta to templates, configures sitemap inclusion, customizes robots.txt, or sets up structured social-share metadata (Open Graph, Twitter cards).Other plugins' skills for the same job