Pointing non-www to a spcific sub-directory

Posted by Ben Sinclair on Stack Overflow See other posts from Stack Overflow or by Ben Sinclair
Published on 2010-04-30T05:33:26Z Indexed on 2010/04/30 5:37 UTC
Read the original article Hit count: 643

Filed under:

I might be going about this all wrong so let me know if I am.

I am creating software that allows people to sign up and have their own sub-domain on my website.

So say my website is ben.com, they could have their own sub-domain called juice.ben.com.

When they type their sub-domain juice.ben.com in their address bar, it will load the contents in a root directory.

I have also set-up a .htaccess redirect to redirect www.ben.com to ben.com. Not sure if this matters with my question but I thought I'd mention it.

Ok, so basically what I think I need to do is put the software they they've signed up to in the root directory. So when someone goes to juice.ben.com, they will be pointed to the root directory (I beleive I cans et-up wild card sub-domains with my host) and the software will then analyse their sub-domain and then display their account.

Now, if someone just types in ben.com into their browser, I want it to show the contents of the ben.com/_website/ folder but still show in the address bar that they are still in the root directory.

Hopefully I am making sense :)

Is this possible with htaccess? If so, what do I need to do?

© Stack Overflow or respective owner

Related posts about .htaccess