HelloZeroNet / HelloZeroNet/ZeroNet
Feature Request: Add URL rewriting to sites
- Dominant language
- JavaScript
- Stars
- 18.8k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Allow each site to specify an URL rewriting scheme in `content.json`.
Proposed syntax:
```
"rewrite_rules": [
{ match: "files/.*", terminate: true },
{ match: "(.*)", replace: "index.html?url=\1", terminate: true },
]
```
The rewriting rules are:
* The URL which is checked to match against the regexp is the part after the site address, non including initial backslash.
* The matching rules are applied recursively until one with `terminate = true` is found. The first matched rule is the one which is applied at each step, each time starting from the first one.
* If the `replace` key is missing the returned string is not modified.
The final url should be then internally rendered and such page returned.
There should not be any html redirect.
If after 100 rewrites the url did not find a terminate condition, the site will log an error and the original request will be made.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.