Hello!
Ive registered here in the hope that anyone can help me. I actually made Google smoke, but didnt find a result that matched my problem. Please excuse my maybe not-so-good english, its not my mother tounge
Description:
Ive got two official domains that point to one webserver that has got an official IP out there. Behind the official IP is a single Apache webserver thats running on a Debian server OS.
For example:
www.company1.com -> 11.22.33.44
www.company2.com -> 11.22.33.44
In the web root are two folders and a .htaccess file:
.
..
.htaccess
company1/
company2/
So when i enter the www.company1.com Domain, i want the browser to be redirected to the folder company1/. And company2/ for the second domain of course.
Now i have already tried to make a php workaround by rewriting the header after reading the referrer that the browser sent. That did work with some browsers, but not with all.
So my second idea was to use mod_rewrite, which seems to be a bit more difficult^^
After some Googling, my .htaccess file looks like that:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^company1\.com$
RewriteRule (.*) http://www.company1.com/$1 [R=301,L]
RewriteRule ^$ company1 [L]
RewriteCond %{HTTP_HOST} ^company2\.com$
RewriteRule (.*) http://www.company2.com/$1 [R=301,L]
RewriteRule ^$ company2 [L]
Actually this works for company1, it redirects the user to www.company1.com/company1 after entering www.company1.com.
The problem is that www.company2.com is redirected to the same directory, i.e. www.company2.com/company1.
I hope anyone is fit enough to help me with this .htaccess file,
Much thanks in advance,
Charly
|