Write this in the TYPOSCRIPT-Setup:
config.simulateStaticDocuments = 0 config.baseURL = http://localhost/subdirectory/ config.tx_realurl_enable = 1
And this to your .htaccess-file.
RewriteBase /subdirectory/
While "subdirectory" is the name of the sub-directory. Change this to your purpose.
If it doesn't work, look if you try hard-coded links, which is a common mistake. I did that mistake yesterday, ;-).