summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-11-01 11:19:51 -0500
committerDrew DeVault <sir@cmpwn.com>2020-11-01 11:19:51 -0500
commitdc6e4e80c0b0a3950594e32db7cff1b2db24d75c (patch)
treeddbec0d5be083daa32f05acdcce25a31489ec999 /doc
parent953039e0b15df9c119b70eb18f36e580a4c4e7d4 (diff)
downloadgmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.tar.gz
gmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.tar.xz
gmnisrv-dc6e4e80c0b0a3950594e32db7cff1b2db24d75c.zip
Implement URL rewrites with regex capture groups
Diffstat (limited to 'doc')
-rw-r--r--doc/gmnisrvini.scd18
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.