views:

57

answers:

2

Hi,

This is rather difficult to explain so please bear with me.

We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain:

  • site-a.com
  • site-b.com
  • sub1.site-b.com
  • sub2.site-b.com

Notice the two sub domains!

However, our client has asked if we can implement the following url structure instead of using subdomains:

  • sub1.site-b.com BECOMES site-b.com/sub1/
  • sub2.site-b.com BECOMES site-b.com/sub2/

Does this make sense so far??? So we are using forward slash as opposed to sub domains.

Can you advise on the best way to achieve this please?

Thanks for any help!

Dave.

+2  A: 

Use Apache to remap the domains. It's probably your webserver, so it's probably the answer.

The docs are here:

http://httpd.apache.org/docs/1.3/mod/mod%5Falias.html#redirect

Match your subdomain and redirect to the appropriate folder, copying and carrying over the query string as appropriate.

JQuery probably won't help you.

Paul McMillan
No, it's not. It was a joke - the answer is _always_ JQuery around here... ;)
Paul McMillan
I almost assumed it, but it sounded a bit too far off :-)
Joey
See, I told you... Kim R suggested javascript. Terrible solution to the problem, but JQuery is _always_ the answer!
Paul McMillan
A: 

This will depend on your hosting situation.

In IIS you can setup virtual directories for this type of behaviour.

You could also use JavaScript or server side redirects in sub1, sub2 etc folders.

Kim R