Forum Moderators: phranque
When Canadians visit mysite.com they are immediately redirected to mysite.ca
Likewise, when Americans visit mysite.ca they are redirected to mysite.com
The two sites are ALMOST identical minus about 10 pages, and the redirection works like a charm. However maintenance is more of a pain than it should be, as when I make a change to one site I have to make the identical change on the other site.
What I want to do is this - code my site such that the pages that are NOT IDENTICAL will be dynamically loaded and delivered based on the users country code. That way I will only need to make changes to one page when editing my site (as opposed to 2).
My question is two fold:
1)Is this search engine friendly?
2)Is this difficult to do in PHP?
Cheers,
Hayden
I'd love to hear what people will say about the search-engine implications, since I'm in the same boat with a couple different sites.
As for the implementation, that's pretty trivial in any scripting or programming language, including PHP - assuming you really know the users' locale.
What I found annoying is that some users actually have their locale set as en_US instead of en_CA. This seems to happen a lot with Mac users and Mozilla browsers. I am considering using IP addresses, but even that is not foolproof, so there has to be a way to let people go from one site to the other :(
There still remains a problem that it's not 100% accurate- and even less so if you need sites that are more internationalized than just US/CAN. Some ISPs have IP addresses that can be used in multiple countries.
Also, if I can't change it from the page, debugging it becomes annoying- I have to make sure the currencies are correct :)
1)Is this search engine friendly?
2)Is this difficult to do in PHP?
This is effectively cloaking, regardless of the reason it's done or the intent behind it. As such, Google may penalize or ban the site IF they become aware of it. Ink will probably ignore the cloaking. SEs are most likely to become aware through a spam report, commonly provided by competitors in a competitive industry. If your industry is not too cutthroat, you'll probably be fine.
I speak a little "pigeon" PHP and so can't comment meaningfully on question #2. I have seen posts indicating that people are frequently redirecting and cloaking using PHP. AFAIK, a page must be named with a .php extension in order to be parsed for PHP code. If that's the case, it may mean renaming pages and losing some traffic until the "new" pages are indexed.
The other way that this could be done would be to put the 10 or so pages that are different in separate folders and create individual .htaccess files for them. Would this option be more viable?
My knowledge of .htaccess is limited but is it possible to just refer to these pages in my current .htaccess?
This can be done in .htaccess but it's better done with a scripting solution. With an .htaccess solution, you'll use mod_rewrite and geolocation becomes awkward because you'll need to screen by IP or do a DNS lookup.
There's a recent thread about it here somewhere but I can't find it! :(
So is this possible to do within my root htaccess? Just specify the filename that will deliver different pages?
For example, let's say that the virtual include footer.txt is something I want different for the Canadians and Americans. But EVERY other file on my site is identical). Can I just put that in my root .htaccess?
Here is my current code (redirects canadians to .ca):
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
RewriteCond %{HTTP_HOST}!^www\.mydomain\.ca$
RewriteRule ^(.*) [mydomain.ca...] [R=301,L]
RewriteCond %{HTTP_HOST}!^www\.mydomain\.com
RewriteRule (.*) [mydomain.com...] [R=301,L]
[edited by: DaveAtIFG at 4:24 pm (utc) on Dec. 8, 2003]
[edit reason] No specifics please [/edit]