Forum Moderators: phranque
The websites are identical except for the language versions; depending on the language version (ie. depending on the entered domain) the proper files are loaded. So I have in setup file this condition:
------
if($_SERVER['HTTP_HOST']=='www.domain.us') {
$baseLang='eng';
$main_url='http://www.domain.us';
}
elseif($_SERVER['HTTP_HOST']=='www.domain.de') {
$baseLang='ger';
$main_url='http://www.domain.de';
}
-------
It works correctly on VPS server where (as I was told) it's possible to point two domains to the same folder. But now I'd like to move the site to a shared host..
My question is - what conditions should I enter in .htaccess so that the server recognizes the correct domain and triggers the correct script? Currently domain.us loads OK, but when I enter domain.de there is "access forbidden" page... Is it possible that this site works correctly on a shared server?
public_html/domainus/ ("main domain")
public_html/domainde/
Do you have an suggestion to fix that? Thanks..
RewriteEngine on
rewritecond %{REQUEST_URI} domain.de/
rewriterule (.*) [domain.us...] [l,nc]
domain.de should resolve to folder: public_html/domainus/
Talk to your host about this problem, since the solution depends specifically on how they have 'user accounts' configured on their servers.
I'm not sure about other configurations, but setting up multiple domains to point to one directory is no problem on my servers which have unique IP addresses. That is, these are IP-address-based shared hosting accounts, not name-based shared hosting accounts. On IP-based shared hosting, the IP address is pointed to a directory by the server config, and the server doesn't need to know the hostname(s); The hostnames are simply pointed to the server's IP address by the DNS zone file, which I control.
On name-based hosting, the server has to know the hostname(s) because it cannot use the IP address to differentiate between "user accounts." And because the hosting companies want to make money, they use the "add-on domain" concept to limit you to one or only a few extra "add-on" hostnames. The usual implementation puts these add-on domains into separate subdirectories, whether that's what you want or not.
I find the typical $1.00 per month extra fee well worth it for a unique IP address, since I can then do as I like with domains and subdomains. Typical applications are extra subdomains for testing and for separate mobile Web sites for cell phones and PDAs, and additional domains -- usually purchased simply for "brand retention" and redirected to the canonical domain, e.g. example.com and example.net, both redirected to example.org.
Jim