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

Option to remove the trailing slash #323

Closed
abdonrd opened this issue Feb 16, 2019 · 3 comments
Closed

Option to remove the trailing slash #323

abdonrd opened this issue Feb 16, 2019 · 3 comments
Labels
DX enhancement New feature or request

Comments

@abdonrd
Copy link
Contributor

abdonrd commented Feb 16, 2019

I would like to have the option to remove the trailing slash, to avoid the SEO duplicate content issue.

When a user go to: myapp.com/user/abdonrd/
Redirects to: myapp.com/user/abdonrd

@abdonrd
Copy link
Contributor Author

abdonrd commented Feb 16, 2019

Posible solution?

{
  path: '(.*)/',
  action: (context, commands) => {
    return commands.redirect(context.pathname.slice(0, -1));
  }
},

@vlukashov vlukashov added DX enhancement New feature or request labels Jul 30, 2019
@abdonrd
Copy link
Contributor Author

abdonrd commented Aug 15, 2019

A problem with this solution (#323 (comment)) is that we are deleting the possible URL search params.

@abdonrd
Copy link
Contributor Author

abdonrd commented Oct 23, 2019

I just tried with this:

// Redirect to URL without trailing slash
{
  path: '(.*)/',
  action: (context, commands) => {
    const newPath = context.pathname.slice(0, -1) + context.search;
    return commands.redirect(newPath);
  }
},

But seems that commands.redirect() does not respect the search. 😕

@abdonrd abdonrd closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants