I am building a couple more sites to add to my portfolio but I have no money to buy domain names for them so I want to temporarily host them on my portfolio eg: myportfolio.com/subsite1
I am unsure how to go about this since these other websites have a root based link structure (href="/page1"), so the "/" would take it to the root if it had its own domain, but since I am hosting it on my portfolio site it would go from portfolio.com/subsite1/page1 - the "/" would take you to portfolio.com, but I want the "/" in my sub site to take me to portfolio.com/subsite1.
how would I go about doing this.... could the htaccess file do this?
No, it can't. There's no way a regular expression could differentiate between a link to "/page1" in one site and "/page1" in another site. The requested URI in the HTTP request is exactly the same.
Either use relative links, full URLs, or host these sites on subdomains of your main domain instead of subfolder.
You could write a quick php script which would scan all the files in a directory, and replace href="/ with href="/subsite1
Thanks for the info. A script could work. I will create a subdomain instead, I looked into it and it seems pretty easy to do. I should have looked into subdomains earlier. They are useful.