From: Rich Bowen Date: Fri, 1 May 2026 17:43:06 +0000 (+0000) Subject: rewrite guide: remove terrible horrible crufty obsolete static-to-dynamic CGI and... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=120d63027deac45b1abd4d1ff1870fbf687408c5;p=thirdparty%2Fapache%2Fhttpd.git rewrite guide: remove terrible horrible crufty obsolete static-to-dynamic CGI and geo-redirect recipes (BZ 58892, step 7) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933676 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/rewrite/remapping.xml b/docs/manual/rewrite/remapping.xml index 3038adec48..8b03fcb322 100644 --- a/docs/manual/rewrite/remapping.xml +++ b/docs/manual/rewrite/remapping.xml @@ -165,40 +165,6 @@ Redirect "/docs/" "http://new.example.com/docs/" -
- - From Static to Dynamic - -
-
Description:
- -
-

How can we transform a static page - foo.html into a dynamic variant - foo.cgi in a seamless way, i.e. without notice - by the browser/user.

-
- -
Solution:
- -
-

We just rewrite the URL to the CGI-script and force the - handler to be cgi-script so that it is - executed as a CGI program. - This way a request to /~quux/foo.html - internally leads to the invocation of - /~quux/foo.cgi.

- - -RewriteEngine on -RewriteBase "/~quux/" -RewriteRule "^foo\.html$" "foo.cgi" [H=cgi-script] - -
-
- -
-
Backward Compatibility for file extension change @@ -396,63 +362,6 @@ RewriteRule "^" "-" [PT]
-
- - Redirecting to Geographically Distributed Servers - -
-
Description:
- -
-

We have numerous mirrors of our website, and want to redirect - people to the one that is located in the country where they are - located.

-
- -
Solution:
- -
-

Looking at the hostname of the requesting client, we determine - which country they are coming from. If we can't do a lookup on their - IP address, we fall back to a default server.

-

We'll use a RewriteMap - directive to build a list of servers that we wish to use.

- - -HostnameLookups on -RewriteEngine on -RewriteMap multiplex "txt:/path/to/map.mirrors" -RewriteCond "%{REMOTE_HOST}" "([a-z]+)$" [NC] -RewriteRule "^/(.*)$" "${multiplex:%1|http://www.example.com/}$1" [R,L] - - - -## map.mirrors -- Multiplexing Map
-
-de http://www.example.de/
-uk http://www.example.uk/
-com http://www.example.com/
-##EOF## -
-
- -
Discussion
-
- This ruleset relies on - HostNameLookups - being set on, which can be - a significant performance hit. - -

The RewriteCond - directive captures the last portion of the hostname of the - requesting client - the country code - and the following RewriteRule - uses that value to look up the appropriate mirror host in the map - file.

-
-
- -
-
Canonical URLs