Solved

can I get a different domain name to show for my site if it is accesed from another country.

Posted on 2014-10-30
5
134 Views
Last Modified: 2014-10-30
can I get a different domain name to show for my site if it is accessed from another country. I have a joomla site with a plugin that can show different content depending on IP but Im curious as to whether I can make the domain name change too. Say I have a .com and when someone accesses from UK they will see .co.uk - is this possible?
0
Comment
Question by:Paul Cotter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 40413505
Yes it is possible - you have to redirect the site.

In your code you have some script that does a lookup in GeoLocation database (Check out Maxmind or similar)

That gives you your country - you then decide if you want to redirect and simply issue a header command

header('location: yourdomain.co.uk');

Open in new window


Full code would be something like

$ip = $_SERVER['REMOTE_ADDR'];
$country = get_country($ip); // CHANGE TO WHATEVER GeoLocation DB API YOU ARE USING
if ($country == 'UK') {
   header('location: yourdomain.co.uk');
}

Open in new window

0
 

Author Comment

by:Paul Cotter
ID: 40413536
Thanks Julian - Im not really great with code. Are we actually redirecting the site or pretending to? I want the same site but with a different URL showing in UK only...
0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 40413682
No it would be a redirect. You can't change the domain name for any given sites. Only redirect between sites.
0
 

Author Comment

by:Paul Cotter
ID: 40413698
Thats what I thought - Thanks Julian:-)
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 40413755
You are welcome - thanks for using EE
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question