Bug 40781 - PATH_TRANSLATED: 'redirect:/~jablko/gallery2/main.php'
Summary: PATH_TRANSLATED: 'redirect:/~jablko/gallery2/main.php'
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 2.2-HEAD
Hardware: All All
: P2 normal with 5 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: MassUpdate
Depends on:
Reported: 2006-10-17 22:37 UTC by ms419
Modified: 2018-11-07 21:08 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description ms419 2006-10-17 22:37:35 UTC
Upon upgrading from to Apache 2.2 from Apache 2.0, when the following rule is
matched, PATH_TRANSLATED is set to 'redirect:/~jablko/gallery2/main.php',
instead of '/home/jablko/public_html/gallery2/main.php'.

    RewriteCond %{HTTP:Authorization} (.+)
    RewriteCond %{QUERY_STRING} !g2_authorization=
    RewriteRule .   %{REQUEST_URI}?g2_authorization=%1   [QSA]

Apache 2.0 always set PATH_TRANSLATED to

When PATH_TRANSLATED is set to 'redirect:/~jablko/gallery2/main.php', CGI like
php-cgi fail:

HTTP/1.1 404 Not Found
Date: Tue, 17 Oct 2006 09:06:46 GMT
Server: Apache/2.2.3 (Debian) DAV/2
X-Powered-By: PHP/4.4.4-3
Content-Length: 25
Content-Type: text/html; charset=UTF-8

No input file specified.

Thanks, Jack
Comment 1 William A. Rowe Jr. 2008-01-30 15:07:27 UTC
An interesting find, thank you.
Comment 2 Troy Rollo 2009-02-21 13:36:31 UTC
This also occurs with a .htaccess file of the following form:

	RewriteEngine on
	RewriteBase /~user/app
	RewriteRule ^(.*)$ /cgi-bin/cgi-prog/~user/app/app.ext?$1

This one can be worked around by changing the .htaccess file to add a handler and modifying the rewrite rule as follows:

	AddHandler run-cgi-prog .ext
	Action run-cgi-prog /cgi-bin/cgi-prog
	RewriteEngine on
	RewriteBase /~user/app
	RewriteRule ^(.*)$ /~user/app/app.ext?$1
Comment 3 Troy Rollo 2009-02-21 14:24:42 UTC
Correction - the work-around .htaccess file should look like this:

	AddHandler run-cgi-prog .ext
	Action run-cgi-prog /cgi-bin/cgi-prog
	RewriteEngine on
	RewriteBase /~user/app/
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(.*)$ app.ext?$1 [L,QSA]
Comment 4 Bob Ionescu 2009-02-22 10:25:12 UTC
The problem is that the subrequest with uri=path_info of the main request (in order to obtain path_translated, i.e. the physical path view of path_info) hits the RewriteRule in per-directory context again and matches; hence no physical path.

Why does this not occur in Apache 2.0? The answer is simple: mod_rewrite doesn't act in subrequests in per-directory context prior version 2.1. The NS flag prevents the processing of RewriteRules in subrequests.
Comment 5 William A. Rowe Jr. 2018-11-07 21:08:13 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.