WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#39833 closed defect (bug) (duplicate)

WP accepts multiple hyphens in URL's without redirecting

Reported by: ivantipov Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: Canonical Keywords:
Focuses: Cc:

Description

This may be a feature, but there's something we've observed when migrating posts from another CMS - WordPress seems to accept URL's with multiple hyphens without redirecting them. Here's an example:

https://developer.wordpress.com/2017/02/09/get-blog-goes-open-source/
https://developer.wordpress.com/2017/02/09/get-blog-goes-open-----source/

This poses potential SEO problems as some of our indexed URL's will have multiple dashes and the internal WP links will be sanitized to single. We can set up redirects but I thought I'd flag it with you since this seems to be an error.

Change History (5)

#1 @rinkuyadav999
4 years ago

Hi @ivantipov

Which plugin are you using to migrating posts from another CMS ?

Please provide more description.

Thanks

#2 @swissspidy
4 years ago

  • Component changed from General to Canonical
  • Keywords needs-patch added

SEO isn't a problem because of <link rel="canonical" tags. Google will see it as 1 URL.

@rinkuyadav999 The plugin is irrelevant.

To reproduce:

  1. Create a new post with title "Foo Bar". The slug will be "foo-bar"
  2. Visit example.com/foo----bar/

#3 @rinkuyadav999
4 years ago

@swissspidy My misunderstanding. Seems it is an issue.

#4 @SergeyBiryukov
4 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @ivantipov, welcome to WordPress Trac!

Thanks for the report, we're already tracking this issue in #14773.

#5 @ivantipov
4 years ago

SEO would be an issue as we have legacy URL's already indexed, which had the canonicals set to multiple dashes. Not setting the redirects would create a mismatch, and setting old URL's in _wp_old_slug metas won't redirect them (since it accepts multiple dashes), so the only solution is setting up custom redirects, which I'd ideally like to avoid to prevent management/performance overhead.

@SergeyBiryukov Thanks, couldn't find it via search.

Note: See TracTickets for help on using tickets.