I'm a cheapskate!!
Posted: Sun Mar 20, 2005 5:43 pm
Here's an "I'm a cheapskate" question
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)
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)