1

I have an AngularJS 1.0.7 web application.

In my app.js:

$routeProvider.when('/:language/alquiler-barcos-:departure', {templateUrl: 'partials/boat-rental.html', controller: 'Controller1Ctrl'});
$routeProvider.when('/:language/boat-rental-:departure', {templateUrl: 'partials/boat-rental.html', controller: 'Controller1Ctrl'});

This will let this correct URLs like: http://domain/es/alquiler-barcos-mallorca or http://domain/en/boat-rental-majorca. This is right.

However, it will also let http://domain/es/boat-rental-mallorca or http://domain/en/alquiler-barcos-majorca which is wrong (or should be, because it´s mixing languages in the URL).

I would like to avoid this, because I think this is not nice from SEO point of view. First, I would like to clarify which is the best practice from SEO point of view in this scenario:

  1. To redirect http://domain/en/alquiler-barcos-majorca to http://domain/en/boat-rental-majorca and show the results

  2. To control the URL and redirect to a 301 error page.

  3. To control the URL and redirect to home page.

After that, is there any way to control these combinations in an AngularJS way in the app.js? Or should just to parse the url in the controller and control it "manually".

Rober
  • 5,868
  • 17
  • 58
  • 110

1 Answers1

1
  1. To redirect http://domain/en/alquiler-barcos-majorca to http://domain/en/boat-rental-majorca and show the results

That's the best SEO option, redirection with a 301.

  1. To control the URL and redirect to a 301 error page.

Not a great option because it is a bad user experience. If you implement it, you should return a 404 or a 410.

  1. To control the URL and redirect to home page.

That is a soft 404, it is better than the second option, but not as great as the first option.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
  • Got it. But just a concern (I´m not skilled with redirections and SEO). If I got options 1, means Google will index http://domain/en/alquiler-barcos-majorca? Because, we don´t want this. And second question, where should I do this redirect 301? I mean, at server level (Nginx config file), or by code, somehow in app.js? – Rober May 13 '15 at 18:32
  • No, it will index http://domain/en/boat-rental-majorca. You can implement it both at the server or at the app level. My preference is the app, but it makes no difference regarding SEO. – Jérôme Verstrynge May 13 '15 at 19:51
  • I´d rather at app level because some of my urls are created dinamically, but can you guide my a little bit how to do it? – Rober May 14 '15 at 14:41
  • I am not an angluar specialist, but this may help you: http://stackoverflow.com/questions/11541695/redirecting-to-a-certain-route-based-on-condition If you need more information, you should ask another question. – Jérôme Verstrynge May 14 '15 at 15:42