httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Neujahr <>
Subject [users@httpd] RewriteRule failing on windows when changing content-handlers
Date Tue, 29 Jun 2010 20:06:47 GMT

I'm having a difficult time figuring out why a RewriteRule isn't 
working, so I'm turning to you folks for some potential help. The 
problem is as follows:

On a 64 bit Windows 7 machine, I have installed apache in D:\Apache. 
The root of the web directory is in E:\cyg\wwwroot. I am using a 
RewriteRule inside a .htaccess file located in 
e:\cyg\wwwroot\oxfordv2 to rewrite non-existant .phps files into .php 
files and at the same time change the handler to be 
application/x-httpd-php-source. When the rewrite happens, the browser 
reports a 404 error and the error log indicates that the script file 
is 'not found or unable to stat'. When the rule is moved directly 
into the VirtualHost container for the site, it functions without 
issue. I have provided what I think are relative snippets of 
information below. If you need further details, please ask and I will 
provide them.

The URL being accessed in both cases is It is successful when 
placed into the VirtualHost but not when in the .htaccess file. If I 
leave off the content-header portion of the rewrite while in the 
.htaccess file, it properly redirects to the new file, but obviously 
processes the file as a .php file and not a .phps file.

The output of error.log when the rewrite fails in .htaccess:

[Tue Jun 29 15:45:20 2010] [error] [client] script 
'redirect:/oxfordv2/page.php' not found or unable to stat

The output of rewrite.log when the rewrite fails in .htaccess: - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (3) [perdir 
E:/cyg/wwwroot/oxfordv2/] strip per-dir prefix: 
E:/cyg/wwwroot/oxfordv2/page.phps -> page.phps - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (3) [perdir 
E:/cyg/wwwroot/oxfordv2/] applying pattern '(.*\.php)s$' to uri 'page.phps' - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (2) [perdir 
E:/cyg/wwwroot/oxfordv2/] rewrite 'page.phps' -> 'page.php' - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (3) [perdir 
E:/cyg/wwwroot/oxfordv2/] add per-dir prefix: page.php -> 
E:/cyg/wwwroot/oxfordv2/page.php - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (2) [perdir 
E:/cyg/wwwroot/oxfordv2/] remember E:/cyg/wwwroot/oxfordv2/page.php 
to have Content-handler 'application/x-httpd-php-source' - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (2) [perdir 
E:/cyg/wwwroot/oxfordv2/] strip document_root prefix: 
E:/cyg/wwwroot/oxfordv2/page.php -> /oxfordv2/page.php - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (1) [perdir 
E:/cyg/wwwroot/oxfordv2/] internal redirect with /oxfordv2/page.php 
[INTERNAL REDIRECT] - - [29/Jun/2010:15:48:39 --0400] 
[][rid#18ba180/initial] (1) force filename 
redirect:/oxfordv2/page.php to have the Content-handler 

Output of rewrite.log when the rule is moved into the vhost entry: - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (2) init rewrite 
engine with requested uri /oxfordv2/page.phps - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (3) applying 
pattern '(.*\.php)s$' to uri '/oxfordv2/page.phps' - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (2) rewrite 
'/oxfordv2/page.phps' -> '/oxfordv2/page.php' - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (2) remember 
/oxfordv2/page.php to have Content-handler 'application/x-httpd-php-source' - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (2) local path 
result: /oxfordv2/page.php - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (2) prefixed with 
document_root to E:/cyg/wwwroot/oxfordv2/page.php - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (1) go-ahead with 
E:/cyg/wwwroot/oxfordv2/page.php [OK] - - [29/Jun/2010:15:51:18 --0400] 
[][rid#1aba180/initial] (1) force filename 
E:/cyg/wwwroot/oxfordv2/page.php to have the Content-handler 

LoadModule php5_module "d:/php/php5apache2_2.dll"
<IfModule php5_module>
     PHPIniDir "d:/php"
     AddType application/x-httpd-php .php
     AddType application/x-httpd-php-source .phps
DocumentRoot "e:/cyg/wwwroot"
<Directory "E:/cyg/wwwroot">
     Options Indexes FollowSymLinks
     AllowOverride FileInfo AuthConfig Limit Options
     Order allow,deny
     Allow from all
Include conf/vhosts.conf

NameVirtualHost *:80
<VirtualHost *:80>
     DocumentRoot "e:/cyg/wwwroot"
     RewriteLog d:/apache/logs/rewrite.log
     RewriteLogLevel 9

Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]

Apache is version 2.2.15, and PHP is 5.3.2.

Thanks for any help or pointers you folks can provide me with.

- Greg

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message