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:     r...@cvs.openbsd.org    2018/06/20 10:43:05

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

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)


Comments
  1. By Will Backman (bitgeist) bitgeist@yahoo.com on http://bsdtalk.blogspot.com

    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?

    Comments
    1. Comments
      1. By Will Backman (bitgeist) bitgeist@yahoo.com on http://bsdtalk.blogspot.com

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

  2. By Atanas Vladimirov (vlado) vlado@bsdbg.net on

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

Credits

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 deadly.org 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.]