Hi all, I want to set up one hosting account and access it via multiple domain names. Each different domain name will server the user slightly different content without the user knowing about the other domains. How do i do this? Example: User comes to my hosting account via www.siteA.com. The whole time the user is on the site the base URL never changes from www.siteA.com. The user needs to see www.siteA.com/page1.php as so on. (Actually i plan to use ModRewrite to alter the page name, but that comes later.) Now when another user comes to www.siteB.com they need go to the same hosting account and see the site as if they have no clue about www.siteA.com, just with some different content. Tested: I have tried using a .htaccess Symlink, but this will not work as it just redirects like a 301. Similar with CNAME's at my registrar. Tested: Frame Forwarding via hosting account. This doesn't work since the forwarded URL doesn't change from the base URL. Meaning, www.siteA.com never changes to www.siteA.com/page1.php. Also any links show the forwarded to's URL in the status bar. I hope my detail in description has been enough and someone has a great suggestion for me. Thanks much. CEsar
Hmm, tried using the $_SERVER['HTTP_HOST'] or $_SERVER['SERVER_NAME'] (preferred as it works in all requests) variables , then creating links of the type: defined('SITE') or define('SITE', 'http://' . str_replace('www.', /* We all hate www. */ '', $_SERVER['SERVER_NAME'])); echo '<a href="' . SITE . '/page1.php">Link</a>'; PHP: It's just a suggestion.
You should use domains in term of folders instead of files. Ex: domain1.com -> domain1.com domain2.com -> domain1.com/domain2/ domain3.com -> domain1.com/domain3/ and so on. This will be easier to manage, backup and read. Peace,
Actually, thinking about it, if you use my suggestion above, and use cPanel (if this is what you are using, it's only an example) to 'Park' the other domains over your current one, it should do almost exactly as you need. I've done it before, and if I understand you correctly, then it's what you want. Dan