AngularJS,混合语言和 SEO 的 URL
AngularJS, URLs mixing languages and SEO
我有一个 AngularJS 1.0.7 网络应用程序。
在我的 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'});
这将使它更正 URL,例如:http://domain/es/alquiler-barcos-mallorca or http://domain/en/boat-rental-majorca。没错。
但是,它也会让 http://domain/es/boat-rental-mallorca or http://domain/en/alquiler-barcos-majorca 这是错误的(或者应该是,因为它在 URL 中混合了多种语言)。
我想避免这种情况,因为我认为从 SEO 的角度来看这不太好。首先,我想澄清在这种情况下,从 SEO 的角度来看,哪种做法是最佳做法:
重定向http://domain/en/alquiler-barcos-majorca to http://domain/en/boat-rental-majorca并显示结果
控制 URL 并重定向到 301 错误页面。
控制URL并重定向到主页。
之后,有没有办法在app.js中以AngularJS的方式控制这些组合?或者应该只是解析控制器中的 url 并控制它 "manually".
- To redirect http://domain/en/alquiler-barcos-majorca to http://domain/en/boat-rental-majorca and show the results
这是最好的 SEO 选项,使用 301 重定向。
- To control the URL and redirect to a 301 error page.
这不是一个很好的选择,因为它会带来糟糕的用户体验。如果您实施它,您应该 return 404 或 410。
- To control the URL and redirect to home page.
那是一个软 404,它比第二个选项好,但不如第一个选项好。
我有一个 AngularJS 1.0.7 网络应用程序。
在我的 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'});
这将使它更正 URL,例如:http://domain/es/alquiler-barcos-mallorca or http://domain/en/boat-rental-majorca。没错。
但是,它也会让 http://domain/es/boat-rental-mallorca or http://domain/en/alquiler-barcos-majorca 这是错误的(或者应该是,因为它在 URL 中混合了多种语言)。
我想避免这种情况,因为我认为从 SEO 的角度来看这不太好。首先,我想澄清在这种情况下,从 SEO 的角度来看,哪种做法是最佳做法:
重定向http://domain/en/alquiler-barcos-majorca to http://domain/en/boat-rental-majorca并显示结果
控制 URL 并重定向到 301 错误页面。
控制URL并重定向到主页。
之后,有没有办法在app.js中以AngularJS的方式控制这些组合?或者应该只是解析控制器中的 url 并控制它 "manually".
- To redirect http://domain/en/alquiler-barcos-majorca to http://domain/en/boat-rental-majorca and show the results
这是最好的 SEO 选项,使用 301 重定向。
- To control the URL and redirect to a 301 error page.
这不是一个很好的选择,因为它会带来糟糕的用户体验。如果您实施它,您应该 return 404 或 410。
- To control the URL and redirect to home page.
那是一个软 404,它比第二个选项好,但不如第一个选项好。