I have been reading through multiple posts on here about htaccess folder spinning but none of them appear to suit my question (correctly).

My real question is:

I've 2 sub folders around the server, website1 and website2.

Whenever a user would go to www.foo.com If only the visual hyperlink to stay the same but want the server URI to visit /website1/ where it'll load the index.php for website1

Then i want exactly the same factor only if a person would go to www.bar.com again the url doesn't change but this time around it links to /website2/ where it'll load the index.php for that second website.

Would actually appreciate outside assistance with this particular as I am still researching rewrites. Good examples with explanations could be highly appreciated. Also any advice of best practice (if their is any) would be also appreciated.

In my opinion you need to only use RewriteCond and RewriteRule directives. Have a look 'Virtual User Hosts' at http://httpd.apache.org/docs/1.3/misc/rewriteguide.html. The logical is identical. (I believe.)

KingCrunch is appropriate -- the best way to setup such atmosphere is by using <VistualHost> directive in Apache config file.

If, for reasons uknown this must be dona via rewrite and .htaccess .. you will want mod_rewrite to become enabled and .htaccess files to become permitted to contain rewrite rule (AllowOverride directive).

Listed here are the guidelines:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# rule #1
RewriteCond %{HTTP_HOST} =www.foo.com
RewriteCond %{REQUEST_URI} !^/website1/
RewriteRule (.*) /website1/$1 [L]

# rule #2
RewriteCond %{HTTP_HOST} =www.bar.com
RewriteCond %{REQUEST_URI} !^/website2/
RewriteRule (.*) /website2/$1 [L]

This code will be put into .htaccess file in root folder. If placed elsewhere (e.g. configuration or virtual host context) some fine-tuning might be needed.

Fist rule is perfect for www.foo.com and 2nd for an additional domain title. These rules are virtually exactly the same. We tell Apache to check on domain title (via {HTTP_HOST} request variable), and when it matches our domain rewrite (internal redirect) URL into one folder much deeper. The 2nd condition would be to prevent rewrite loop (not to to rewrite already rewritten URL). It's important as Apache after performing rewrite goes to another rewrite iteration (that's how it operates) which condition is needed to prevent the loop.

Helpful link: http://httpd.apache.org/docs/current/rewrite/