If you have TYPO3 installed in a subfolder and a domain
record with that subfolder (localhost/subfolder/ for
example) TYPO3 only generates absolute links in the
frontend.
This is because the typoLink function compares the
HTTP_HOST var with the domainRecord. HTTP_HOST is in
this case "localhost", the domain record has the subfolder
attached. The subfolder needs to be there, as otherwise
t3lib_pageSelect::getDomainStartPage does not find the
start page anymore. typoLink should check for HTTP_HOST +
path of SCRIPT_NAME to determine which domain record
to use (same as getDomainStartPage already does).