diff options
| author | Drew DeVault <sir@cmpwn.com> | 2020-11-01 11:19:51 -0500 |
|---|---|---|
| committer | Drew DeVault <sir@cmpwn.com> | 2020-11-01 11:19:51 -0500 |
| commit | dc6e4e80c0b0a3950594e32db7cff1b2db24d75c (patch) | |
| tree | ddbec0d5be083daa32f05acdcce25a31489ec999 /doc/gmnisrvini.scd | |
| parent | 953039e0b15df9c119b70eb18f36e580a4c4e7d4 (diff) | |
| download | gmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.tar.gz gmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.tar.xz gmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.zip | |
Implement URL rewrites with regex capture groups
Diffstat (limited to 'doc/gmnisrvini.scd')
| -rw-r--r-- | doc/gmnisrvini.scd | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/gmnisrvini.scd b/doc/gmnisrvini.scd index 5b936e5..78c80be 100644 --- a/doc/gmnisrvini.scd +++ b/doc/gmnisrvini.scd @@ -91,6 +91,24 @@ Within each routing section, the following keys are used to configure how *[example.org:/foo]* with the root set to /srv/gemini, /srv/gemini/foo/bar.txt will be served. +*rewrite* + If regular expression routing is used, the rewrite directive may be used + to rewrite the URL path component before proceeding. The URL will be set + to the value of the rewrite expression. If *\\N* appears in the rewrite + value, where *N* is a number, that capture group will be substituted for + *\\N*. If *\\{name}* appears, where *name* is a named capture group, it + will be substituted. + + Example: + + ``` + [localhost~^/([a-zA-Z]+)\.(?<extension>png|jpg)$] + root=./root + rewrite=/images/\1.\{extension} + ``` + + This will rewrite a request for /example.png to /images/example.png. + *index* Configures the name of the index file which shall be served in the event that a request for this host does not include the filename part. |
