OpenBSD Journal

httpd(8) Gains Simple Request Rewrites

Contributed by rueda on from the and-there-was-much-rejoicing dept.

Reyk Floeter (reyk@) has committed support for simple request rewrites to httpd(8)/ httpd.conf(5) [in -current]:

CVSROOT:        /cvs
Module name:    src
Changes by:    2018/06/20 10:43:05

Modified files:
        usr.sbin/httpd : config.c httpd.conf.5 httpd.h parse.y 

Log message:
Add support for simple one-off internal rewrites.

For example:

location match "/page/(%d+)/.*" {
request rewrite "/static/index.php?id=%1&$QUERY_STRING"

Requested by many.

Ok benno@

(Comments are closed)

  1. By Will Backman (bitgeist) on

    Would this allow the rewrite of http to https?
    I’m used to this rewrite in Apache:
    RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
    If so, what would the syntax be?

      1. By Will Backman (bitgeist) on

        As usual, the best answers are right there in the installed documentation. :)
        Than you!

  2. By Atanas Vladimirov (vlado) on

    Does anyone know if this rewrite could be used with wordpress permalinks and how?


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]