RewriteRule failing on windows when changing content-handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 http://dev.domain.com/oxfordv2/page.phps. 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 127.0.0.1] script 'redirect:/oxfordv2/page.php' not found or unable to stat

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

127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][rid#18ba180/initial] (3) [perdir E:/cyg/wwwroot/oxfordv2/] strip per-dir prefix: E:/cyg/wwwroot/oxfordv2/page.phps -> page.phps 127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][rid#18ba180/initial] (3) [perdir E:/cyg/wwwroot/oxfordv2/] applying pattern '(.*\.php)s$' to uri 'page.phps' 127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][rid#18ba180/initial] (2) [perdir E:/cyg/wwwroot/oxfordv2/] rewrite 'page.phps' -> 'page.php' 127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][rid#18ba180/initial] (3) [perdir E:/cyg/wwwroot/oxfordv2/] add per-dir prefix: page.php -> E:/cyg/wwwroot/oxfordv2/page.php 127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][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' 127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][rid#18ba180/initial] (2) [perdir E:/cyg/wwwroot/oxfordv2/] strip document_root prefix: E:/cyg/wwwroot/oxfordv2/page.php -> /oxfordv2/page.php 127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][rid#18ba180/initial] (1) [perdir E:/cyg/wwwroot/oxfordv2/] internal redirect with /oxfordv2/page.php [INTERNAL REDIRECT] 127.0.0.1 - - [29/Jun/2010:15:48:39 --0400] [dev.domain.com/sid#18a5b30][rid#18ba180/initial] (1) force filename redirect:/oxfordv2/page.php to have the Content-handler 'application/x-httpd-php-source'

Output of rewrite.log when the rule is moved into the vhost entry:

127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (2) init rewrite engine with requested uri /oxfordv2/page.phps 127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (3) applying pattern '(.*\.php)s$' to uri '/oxfordv2/page.phps' 127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (2) rewrite '/oxfordv2/page.phps' -> '/oxfordv2/page.php' 127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (2) remember /oxfordv2/page.php to have Content-handler 'application/x-httpd-php-source' 127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (2) local path result: /oxfordv2/page.php 127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (2) prefixed with document_root to E:/cyg/wwwroot/oxfordv2/page.php 127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (1) go-ahead with E:/cyg/wwwroot/oxfordv2/page.php [OK] 127.0.0.1 - - [29/Jun/2010:15:51:18 --0400] [dev.domain.com/sid#1aa5b30][rid#1aba180/initial] (1) force filename E:/cyg/wwwroot/oxfordv2/page.php to have the Content-handler 'application/x-httpd-php-source'

httpd.conf
----------
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
</IfModule>
DocumentRoot "e:/cyg/wwwroot"
<Directory "E:/cyg/wwwroot">
    Options Indexes FollowSymLinks
    AllowOverride FileInfo AuthConfig Limit Options
    Order allow,deny
    Allow from all
</Directory>
Include conf/vhosts.conf

vhosts.conf
-----------
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName dev.domain.com
    DocumentRoot "e:/cyg/wwwroot"
    RewriteLog d:/apache/logs/rewrite.log
    RewriteLogLevel 9
</VirtualHost>

e:\cyg\wwwroot\oxfordv2\.htaccess
---------------------------------
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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux