I have Friendly URLs turned on, and wanted to have processed URLs that point at my home page to be pointed at the root of my site, but I could not find a way of creating an alias of ’ ’ (which is logical really). The rest of my URLs are just set to have a ’/’ appended to them and no prefix.
With the home page I wanted links to point to:
*ttp.x2.dev/
instead of:
*ttp.x2.dev/1/
I ended up creating a plugin that listens to ’OnWebPagePrerender’, and simply rips off the end of the link.
Is there a better way to do this?
$output = $modx->documentOutput;
$pattern = '/href=\"1\/\"/';
$replacement = 'href="/"';
$modx->documentOutput = preg_replace($pattern, $replacement, $output);