rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Adonis router 'strict match mode'

Open nanodracula opened this issue 8 years ago • 3 comments

Brief history

By default Adonis router is case insensitive and doesn't respect trailing slash. Though Google and most other search engines treat URLs like:

  • /Test
  • /test
  • /test/
  • /Test/ as different urls and can index it as 4 urls, even though in reality it's the same page. This is not good in SEO point of view and can cause decrease positions in search engines result page.

What problem does it solve?

Prevent search engines from indexing duplicated content.

Proposal

I suggest Add config option to enable case 'sensitive matching' and 'strict mode'. I find out that Adonis internally use https://github.com/pillarjs/path-to-regexp this module for parsing urls, and it already has this two options out of the box.

Are you willing to work on it?

It's hard for me to find out how to correctly make options and pass it to '/src/Route/index.js' (if i'm not mistaken here is where we match urls with 'path-to-regexp') since I'm not good at OOP and advanced design patterns that Adonis uses. But I can update docs if needed

nanodracula avatar Aug 23 '18 14:08 nanodracula

This sounds reasonable. I will look into it when working on the router. Thanks

thetutlage avatar Oct 03 '18 19:10 thetutlage

two years have passed ;)

ed-fruty avatar May 19 '20 14:05 ed-fruty

New to Adonisjs, but I'd also appreciate this functionality.

mjclemente avatar Jun 16 '20 18:06 mjclemente