-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting ERROR 404 on Google search console #491
Comments
There is no strategy called Otherwise, maybe you should consider using |
Hello @rchl https://nuxt-community.github.io/nuxt-i18n/routing.html#prefix Also, I want it to be /es for the future, so I don't have to change all url in the future for SEO purposes. Thanks. |
Ok for now as this is not working properly (don't know if it is my fault) and I need to get a solution right now, I am gonna follow your suggestion as there is an strategy called prefix_except_default so in the future, I can keep all the urls with the same / path and also add /en later. Thanks, I am gonna close this, If anyone is getting the same problem, be free to open it again so they can take a look at this problem. |
You're right. I'll have a look at what might be a problem with |
Well, I have same issue. I use the If I acces to |
Sorry, I can't reproduce that. I've created codesandbox with basic "prefix" configuration at https://codesandbox.io/s/nuxt-i18n-strategy-prefix-5860y Going to the root URL, without locale prefix, works for me whether cookie is set or not (in incognito mode). If you have some more information on how to reproduce then please post here. |
Sorry to answer so late. Well, I have reproduced my configuration in this codesandbox: https://codesandbox.io/s/nuxt-i18n-strategy-prefix-0yhex If you clear your cookies and go to the repo URL in codesandbox browser, you will get:
If you to to https://0yhex.sse.codesandbox.io/ca or https://0yhex.sse.codesandbox.io/es, it will print the correct message and will set a cookie, then it will automatically redirect from now on. Thanks rchl! |
Thanks a lot. I can see the problem now and will look into it. |
I really wanted to fix it but the more I've looked, I've realized that fixing this would basically make any page redirect which means it would be impossible to get 404 response for any URL. That's not good for SEO. There is |
Well, with I think that the trick will be that you can get the browser language and then set the Maybe you can add a // Handle auto detect root path redirect
if (route.path === '/' && autoDetectRootRedirect) {
let lang = navigator.language
// Then, you can check if language is in locales.
// Finally, redirect to browser's language
redirect('/' + lang, route.query)
return
}
// Then, original rootRedirect code:
// Handle root path redirect
if (route.path === '/' && rootRedirect) {
redirect('/' + rootRedirect, route.query)
return
} |
I don't want to add new options unless absolutely necessary. There are so many right now, it's close to impossible to think of all permutations and feel safe while making a change (there are tests but those don't cover all cases either since there are so many variants...). Unfortunately, I'm short on time right now and I can't think of a quick and safe solution. Also, there are many things to consider with changing that. For example, should behavior depend on |
Ok, I understand you. But, how this issue can be solved? Maybe if |
Any solutions to fix this? Or updates? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sorry, I don't have time right now to figure out how to fix it. Especially as it's unclear what the fix would have to be (if you consider all the cases). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This specific case (configuration posted in the initial comment) appears to have been fixed by #510. |
Changes the `setLocale` logic to, in case current route is 404, to try to find a matching one for current locale. This is for situations when using `prefix` strategy where the root (`/`) route doesn't exist. We will try to find and redirect to prefixed route matching resolved locale. Also worked around Nuxt issue (nuxt/nuxt#4491 ) with `redirect` not working when called from a plugin in SPA mode. Required for the above fix above to be functional in SPA. Resolves #677 Resolves #491
Changes the `setLocale` logic to, in case current route is 404, to try to find a matching one for current locale. This is for situations when using `prefix` strategy where the root (`/`) route doesn't exist. We will try to find and redirect to prefixed route matching resolved locale. Also worked around Nuxt issue (nuxt/nuxt#4491 ) with `redirect` not working when called from a plugin in SPA mode. Required for the above fix above to be functional in SPA. Resolves #677 Resolves #491
Version
v5.3.0
Steps to reproduce
Here is my nuxt-i18n configuration.
What is expected ?
Redirect to /es as it is the only one available language.
What is actually happening?
Google Search Console is telling me that I have an ERROR 404 in / when crawling data from my website

Additional comments?
I have no problem entering the webpage, but my website is not being indexed by Google on their Search Engine because of this.
The text was updated successfully, but these errors were encountered: