codeGEN
codeGEN

Reputation: 714

Duplicate content on multi language URL structure

I am using CodeIgnitore to develop a multi language website. At the moment I have set up the routing as follows.

$route['default_controller'] = "home";
$route['^(en|fr)/(.+)$'] = "$2";
$route['^(en|fr)$'] = $route['default_controller'];
$route['404_override'] = '';

Now I have the ability to access the homepage with the following URLs

  1. domain.com
  2. domain.com/en

Both these URLs shows the home page in english so will this be penalized for duplicate content & affect SEO. I have other URLs that would cause the same issue. Is there any solution this?

Thanks.

Upvotes: 0

Views: 98

Answers (1)

mdunisch
mdunisch

Reputation: 3697

you can redirect domain.com -> domain.com/en.

So you don't have duplicate content.

In your home.php (application/controllers/home.php):

function __construct(){
    parent::__construct();

    if(!preg_match("/(en|fr)/",$_SERVER['HTTP_HOST'])){
         $this->load->helper('url');
         redirect('/en', 'location', 301);
    }
 }

Upvotes: 2

Related Questions