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.

Default path prefix (BaseRoot)

See original GitHub issue

hi there, I’m using next-routes in a project. I was wondering if I can set a default root path in production sites like https://project.foo.com/branch/master/ – In this case I either need relative links or prepend /branch/master everywhere, is this somehow possible? thanks for suggestions.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
cyrstroncommented, Jun 26, 2018

Hi,

I’m trying to add localization prefix to url string for my app. However, I still need app pages to be available without prefix for executing redirect to url with localization prefix if such page exist.

At the moment best solution I see is given below:

routes.add('/:lang(en|de)/', 'index');
routes.add('/:lang(en|de)/about-us',` 'about-us');

I that case page is available for both situations: with and without (for further redirect) prefix and also I have 404-error when there is no matches with existing pages.

The only problem here is that I have to write each page I create to routes.js. Is there any way to add prefix for whole pages folder without writing every single page?

0reactions
alololoxcommented, Dec 12, 2019

@nwalters512 did you ever implement a solution for this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understand Default URL Pattern - Contentstack
Base URL: The consistent part or the root of your website's address. For example, http://www. ... Prefix URL: Denotes the path where the...
Read more >
API Host and Base Path - Swagger
basePath is the URL prefix for all API paths, relative to the host root. It must start with a leading slash / ....
Read more >
How to set default path (route prefix) in express?
setRootPath(myPath ) I would like to, in my underlying code to be able to set the root path so I only ever need...
Read more >
How to prefix base route for all service service routes
I using Servicestack self hosting and I'm wanting to prefix ALL routes with “api/” base path. I can modify the routes defined by...
Read more >
Adding a Path Prefix - Gatsby
Many applications are hosted at something other than the root ( / ) of their domain. ... Adding pathPrefix to gatsby-config; gatsby build;...
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