Skip to content
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

/user/ redirect to /user #22254

Closed
rahulkumarsingh73690 opened this issue Jul 20, 2023 · 19 comments
Closed

/user/ redirect to /user #22254

rahulkumarsingh73690 opened this issue Jul 20, 2023 · 19 comments

Comments

@rahulkumarsingh73690
Copy link

Environment



Reproduction

Not now

Describe the bug

After updating to nuxt 3 3.6.5 from 3.5.* trailingSlash removed. Is there any way to enable this feature because for SEO this is bad

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

Would you provide a reproduction? 🙏

@rahulkumarsingh73690
Copy link
Author

rahulkumarsingh73690 commented Jul 21, 2023

Check here

When I use nuxt generate /test/ goes to /test however in dev no changes /test/ to /test/

Due to some issue can't prerender in nuxt to test. You need to test locally

@danielroe
Copy link
Member

I can't reproduce this locally.

CleanShot 2023-07-24 at 15 21 55

@rahulkumarsingh73690
Copy link
Author

Let me check

@rahulkumarsingh73690
Copy link
Author

rahulkumarsingh73690 commented Sep 20, 2023

I have a new small project the same issue occurred, but I would like to provide private repository access.

@danielroe Which user should I give private repo access to?

@rahulkumarsingh73690
Copy link
Author

rahulkumarsingh73690 commented Sep 20, 2023

/font-keren/ redirects to /font-keren

I tried creating middleware to fix this, but it goes into an infinite loop of redirecting

Command - npm run generate

Deployed on cloudflare pages

@manniL
Copy link
Member

manniL commented Sep 21, 2023

Provide a minimal reproduction please. Otherwise it will be difficult to help.
Also be aware that some platforms, e.g. Netlify, have their own trailing slash rules that they apply!

So does Cloudflare pages apparently, see https://developers.cloudflare.com/pages/platform/serving-pages/#route-matching

You can maybe work around by using the nitro option below (available since Nitro v2.6.3):

defineNuxtConfig({
  nitro: {
    prerender: {
      autoSubfolderIndex: false
    }
})

@rahulkumarsingh73690

This comment was marked as off-topic.

@manniL

This comment was marked as off-topic.

@rahulkumarsingh73690

This comment was marked as off-topic.

@manniL
Copy link
Member

manniL commented Sep 21, 2023

Please try the above mentioned fix :)
If it doesn't work, provide a minimal reproduction ☺️

@rahulkumarsingh73690

This comment was marked as off-topic.

@rahulkumarsingh73690

This comment was marked as off-topic.

@github-actions
Copy link
Contributor

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

@manniL
Copy link
Member

manniL commented Sep 21, 2023

rahulkumarsingh73690/cuping-font

This is not a minimal reproduction. Please check the text above and provide one with as little business logic, additional files etc. as possible. ☺️

I'm afraid that it is not feasible going through a project file that contains more than just how to reproduce the issue.

Also, please add instructions how to reproduce the problem.

@rahulkumarsingh73690
Copy link
Author

I didn't understand what makes this issue happen, I created new project everything works fine that's why I shared repo it contains only few pages

@rahulkumarsingh73690
Copy link
Author

rahulkumarsingh73690 commented Sep 21, 2023

/disclaimer/ goes to /disclaimer/
/font-keren/ redirects to /font-keren (why?)

@ennioVisco
Copy link
Contributor

@rahulkumarsingh73690 how did you solve it?

@rahulkumarsingh73690
Copy link
Author

@ennioVisco use server side rendering that's it

silverwolf42 added a commit to silverwolf42/nuxt.com that referenced this issue Dec 26, 2023
Cloudflare Pages route matching is:
	/contact.html redirected to /contact
	/about/index.html redirected to /about/

For statically generated sites, use the nitro option `autoSubfolderIndex` to disable auto generated subfolder.

defineNuxtConfig({
  nitro: {
    prerender: {
      autoSubfolderIndex: false
    }
})

more discussion about this, refer to nuxt/nuxt#22254 (comment)
atinux added a commit to nuxt/nuxt.com that referenced this issue Dec 27, 2023
* docs(deploy): add Cloudflare Pages route matching

Cloudflare Pages route matching is:
	/contact.html redirected to /contact
	/about/index.html redirected to /about/

For statically generated sites, use the nitro option `autoSubfolderIndex` to disable auto generated subfolder.

defineNuxtConfig({
  nitro: {
    prerender: {
      autoSubfolderIndex: false
    }
})

more discussion about this, refer to nuxt/nuxt#22254 (comment)

* Update content/3.deploy/cloudflare.md

* Update content/3.deploy/cloudflare.md

---------

Co-authored-by: Sébastien Chopin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants