The simplest solution is to use absolute URLs for all your assets.
right - you mean just point to {{ site.baseurl }}/wiki/ ? I am doing that currently, but if someone casually shares the link to just the wiki without the slash it will fail
It would have been possible to exclude a URL from the wildcard but that’s not possible in the proxy setup that you currently have.
could you be more specific about how I would do that?
No, I meant to refer the CSS/JS assets with absolute URLs. So instead of gitbook/foo.css you include the absolute path of where the resource actually exists.
This part is easily achievable using:
/foo /foo 200!
/* /bar 200!
In the above example, you’re rewriting /foo back to /foo. Since it’s the first rule in order, it’s given preference. And since Netlify only proxies once (doesn’t go on following the proxy target), it doesn’t create a redirect loop. The wildcard rule is below this so it’s given less priority. But anything that’s not /foo will be captured by wildcard redirect and would redirect elsewhere.
problem: redirect is working fine, but only to Introduction | Asellus Wiki ← slash at the end is needed, which is problematic
config: homepage, wiki (wiki config is turned off at the moment - I wanted a domain level rewrite, but it leads to infinite loop). I also tried adding the slash with asset optimization, Redirect options | Netlify Docs, but that didn’t work either.
I have the same problem with another site, so a global solution to this would be terrific. I am not 100% what the core issue is here, I would frankly also be happy if the site would work without that last slash, but I guess then I would have to do what you suggested and rewrite all links to content and assets to absolute URL. Not sure how I would accomplish that though, bc the wiki is autogenerated from markdown source files.
The base url element was exactly what I was looking for and solved all my problems. Thanks for your help and patience, and sorry for the messy thread - feel free to edit.