Forum Moderators: phranque
I have 2 domain names let's say
1.) webmasterworld1.com
2.) webmasterworld2.com
the .htaccess redirection works perfectly with the first domain however, visitors landed on the wrong page if they use the 2nd domain.
I have a catch-all subdomain and based on the subdomain that was entered, the a scripts redirects them to its appropriate page.
my code for both domains are the same:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI}!^/mypage\.php
RewriteCond %{HTTP_HOST}!^www\.webmasterworld1\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.webmasterworld1\.com
RewriteRule .* [webmasterworld1.com...] [R]
RewriteCond %{REQUEST_URI}!^/mypage\.php
RewriteCond %{HTTP_HOST}!^www\.webmasterworld2\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.webmasterworld2\.com
RewriteRule .* [webmasterworld2.com...] [R]
any suggestion how it will work?
thanks in advance.
Different parking services do it differently. If they are redirecting the second domain to the first domain, then HTTP_HOST will never indicate the second domain, since the parking service redirect will have already changed it before it ever reaches your server.
The first step is to check out your parked domain URLs using a server headers checker, and see exactly what mechanism is used to forward the traffic to your server. It's most likely a 301 or 302 redirect.
Note that you could always simply change the DNS for the parked domain and point it to your server, as long as your host will allow this and set up the server config to recognize requests for the second domain and pass them to your first domain's filespace.
I don't use parking, as I see it as an unnecessary complication.
Jim
The first step is to check out your parked domain URLs using a server headers checker, and see exactly what mechanism is used to forward the traffic to your server. It's most likely a 301 or 302 redirect.
I'm sorry, but I don't fully understand it. I parked the second domain using the CPanel Parked Domain.
Note that you could always simply change the DNS for the parked domain and point it to your server, as long as your host will allow this and set up the server config to recognize requests for the second domain and pass them to your first domain's filespace.
the host say something about wildcard DNS and dedicated IP for the the .htaccess for the redirection to work. Though the redirection script in .htaccess worked on the first domain, but it wont work on the second domain.
the second domain seems to ignore (or probably remove) the parameters that PHP is passes to it which is on this line header("Location:http://".$_SERVER['HTTP_HOST']."/index.php?a=6&b=$userid");
thanks for the reply sir.
[edited by: jdMorgan at 3:17 pm (utc) on April 11, 2006]
[edit reason] Formatting [/edit]
I'd assume that the second domain name resolves to your server, as long as you're not getting DNS-related failures when trying to browse to that domain, but basically, you need to check every step to be sure.
Jim