I have been using this plugin:
Web Root Relative Hrefs for ages - works perfectly.
You dont need to use the BASE HREF at all when using the plugin.
I have a slightly modified version which can be used if anyone is interested:
<?php
$webroot = '/';
$e = &$modx->event;
if ($e->name == 'OnWebPagePrerender') {
$o = &$modx->documentOutput;
$o = preg_replace('%href="(?!http)(?!/)(?!#)(?!javascript:)(?!{\$)(?!ftp:)(?!&#)(?!mailto)%i','href="'.$webroot,$o);
$o = preg_replace('%src="(?!http)(?!/)(?!#)(?!ftp:)(?!mailto)%i','src="'.$webroot,$o);
$o = preg_replace('%@import "(?!http)(?!/)(?!#)(?!ftp:)(?!mailto)%i','@import "'.$webroot,$o);
$o = preg_replace('%action="(?!http)(?!/)(?!#)(?!ftp:)(?!mailto)%i','action="'.$webroot,$o);
}
$e->output($o);
?>
The only drawback that I have had is when using inline CSS, using background images - but again easy to solve by adding
in the images source path e.g
style="background-image:url([(base_url)]assets/images/myimage.jpg)"
Cheers
[ed. note: iusemodx last edited this post 14 years, 8 months ago.]