Page 1 of 1

I'm a cheapskate!!

Posted: Sun Mar 20, 2005 5:43 pm
by Chris Corbyn
Here's an "I'm a cheapskate" question :wink: LOL

I pay for a hosting plan which allows for up to 2 domains on the same account. I have used these two domains. However, I can have up to 5 parked domains for each of the registered domains. You with me so far?

OK, I'm looking for a way to make 2x5 = 10 domains with a bit of PHP trickery.

I can use $_SERVER['SERVER_NAME'] in my index.php the see where they are viewing my site from.. good good. From this, I can very easily use include('./website_dir_for_this_domain/'); and I'd see the website that I wanted that domain to be for. BUT, if one was then to click a link on the page, the relative URLS would not work since they would be relative the root dir only. I don't want a redirect since the user sees this and it doesn't look like a TLD.

My question is. Is there anyway to trick PHP into thinking that the current working directory is the directory of the website I want to use for that URL?....

For example's sake I own http://www.mywebsite.co.uk/.

So lets say I have http://www.website1.co.uk/ (a parked domain) under a dir called 'website1_root'.

When a user goes to http://www.website1.co.uk/ my index page calls include('./website1_root/');

Now lets say a user goes to http://www.website1.co.uk/somedir/ What I would want to happen is that the script calls include(./website1_root/somedir/); NOT include('./somedir') as it naturally would do. Possible with PHP?

Thanks (Told you I'm a cheapskate) :lol:

Posted: Sun Mar 20, 2005 5:47 pm
by feyd
mod_rewrite. no PHP trickery :)

Posted: Sun Mar 20, 2005 5:50 pm
by Chris Corbyn
DOH... How dumb am I!!! I was just rushing back to remove the posy before anybody spotted it..

How the hell could I expect index.php to load and validate what should happen if the user calls ./somedir??? :oops:

I shall use mod-rewrite! Thanks.

Hey, do you think my host could give me a telling off for not paying 3x the price for the privilege? Well c'mon, I mean, I wont use more bandwidth or space so what's the deal? LOL.

Posted: Sun Mar 20, 2005 6:09 pm
by feyd
they can't bitch about using a feature they offer.. but they can turn it off if you are abusing their systems in some fashion (check your TOS and stuffs)