question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect route matching with subfolder root

See original GitHub issue

Hello Krasimir,

I deployed a site on Github Pages inside a subfolder and set Navigo’s root to that subfolder i.e. new Navigo('/bohemica-studio-website').

I am getting a wrong match for Navigo links when the href path is (correctly) set to "bohemica-studio-website/en/projects/branding". The matching route should be bohemica-studio-website/:language/projects/:name, but it ends up being bohemica-studio-website/*.

Interestingly, when I call the router.match('bohemica-studio-website/en/projects/branding'), I get the correct route. Same, when I set the link without the root path i.e. "en/projects/branding"

Screenshot 2021-02-20 at 11 16 08

Maybe, there is some wrong deployment setting, but I feel that Navigo is being fed the right data, so it’s likely an internal issue. What do you think?

Thank you ✌️

P.S. Everything works fine on localhost when the root path is set to '/'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stepanjaklcommented, Mar 1, 2021

I swapped the project a custom domain (and root folder), so I cannot test it. But it looks good and would consider it fixed👍

1reaction
krasimircommented, Feb 21, 2021

I see @stepanjakl. I would rather patch the generate method so it returns the path without app than forcing the full url path on the links. Conceptually the idea of Navigo is to be an app oriented. It shouldn’t know about the rest of the world. So I’ll probably provide an additional argument to the generate function which will strip the root.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Route not found/matched when using symfony 4 inside a ...
the problem is, that the "root" directory (in the view from the web server) is the public directory (and the contained index.php )...
Read more >
Deploying React (Router) app to the subfolder on server
If you ever had to deploy React Router app to the subfolder on the server, you know what the problem is. Routes will...
Read more >
The match never happens · Issue #184 - GitHub
Tbf I have a weird file structure so it's probably coming from that part. The issue rn is that accessing a basic mapped...
Read more >
Drupal base URL changed to match subfolder but root relative ...
I changed the Drupal base url in settings.php to " http://www.example.com/subfolder " but root relative paths are still pointing to ...
Read more >
Finding files in project subdirectories
In this case, the following method reliably finds our project root: Start the search in any subdirectory of our project.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found