Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: Why doesn’t "!-f" work correctly? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
jacob santos
Newbie
Newbie


Joined: 21 August 2008
Location: United States
Online Status: Offline
Posts: 3
Posted: 21 August 2008 at 3:39pm | IP Logged Quote jacob santos

The problem with the debugging is that it doesn't show what the "-f" and "!-f" is being matched, it just shows a blank string.

Code:
RewriteCond: input='C:/PATH/TO/index.html' pattern='' => matched


The problem is that it is matching something that has "!-f", which the file does exist. This is against the specification. Also "-f" does not match against files that exist, which leads me to believe that the implementation is poorly done, since it works in mod_rewrite.

Code:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ $1 [L]

RewriteCond %{HTTP_HOST}   ^bransontourismcenter\.com [NC]
RewriteRule ^(.*)$ http://www.bransontourismcenter.com$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/index.htm$ [OR]
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteRule ^(.*)$ /index.html [R=301, L]

RewriteCond %{REQUEST_URI} ^/?upcomingbransonevents.htm$
RewriteRule ^(.*)$ http://www.bransontourismcenter.com/events/ [R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.htm(l?)$
RewriteRule ^(.*)\.htm(l?)$ $1.php [QSA, NC]


The file index.html is expected to match against

Code:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ $1 [L]


But is matching against
Code:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.htm(l?)$
RewriteRule ^(.*)\.htm(l?)$ $1.php [QSA, NC]


Which leads to a 404 error since it is rewriting the index.html (which does exist) to index.php (which does not exist).

These rules have been confirmed to work correctly.

Code:

RewriteCond %{HTTP_HOST}   ^bransontourismcenter\.com [NC]
RewriteRule ^(.*)$ http://www.bransontourismcenter.com$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/index.htm$ [OR]
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteRule ^(.*)$ /index.html [R=301, L]

RewriteCond %{REQUEST_URI} ^/?upcomingbransonevents.htm$
RewriteRule ^(.*)$ http://www.bransontourismcenter.com/events/ [R=301]


However they only work with the omission of "-f".

I'm currently using the trial Pro version and I'm not going to buy this until these rules work. If they can work, then I'll be buying the ISAPI module. However, I mean, this should work in the free version also, but it doesn't.

IIS 6 + Windows 2003 using ISAPI_Rewrite 3 Trial version.
Back to Top View jacob santos's Profile Search for other posts by jacob santos
 
jacob santos
Newbie
Newbie


Joined: 21 August 2008
Location: United States
Online Status: Offline
Posts: 3
Posted: 21 August 2008 at 3:42pm | IP Logged Quote jacob santos

rewrite.log:

Code:

init rewrite engine with requested uri /index.html
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^(.*)$' to uri 'index.html'
(4) RewriteCond: input='C:/Inetpub/vhosts/bransontourismcenter.com/httpdocs/index.html' pattern='' => not-matched
(3) applying pattern '^(.*)$' to uri 'index.html'
(4) RewriteCond: input='www.bransontourismcenter.com' pattern='^bransontourismcenter\.com' => not-matched
(3) applying pattern '^(.*)$' to uri 'index.html'
(4) RewriteCond: input='/index.html' pattern='^/index.htm$' => not-matched
(4) RewriteCond: input='/index.html' pattern='^/index.php$' => not-matched
(3) applying pattern '^(.*)$' to uri 'index.html'
(4) RewriteCond: input='/index.html' pattern='^/?upcomingbransonevents.htm$' => not-matched
(3) applying pattern '^(.*)\.htm(l?)$' to uri 'index.html'
(4) RewriteCond: input='C:/Inetpub/vhosts/bransontourismcenter.com/httpdocs/index.html' pattern='' => matched
(4) RewriteCond: input='/index.html' pattern='\.htm(l?)$' => matched
(1) escaping /index.php
(1) Rewrite URL to >> /index.php
(2) rewrite 'index.html' -> '/index.php'
(2) internal redirect with /index.php [INTERNAL REDIRECT]


Is there a way to have the rewrite log not log the IP address?
Back to Top View jacob santos's Profile Search for other posts by jacob santos
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 5225
Posted: 22 August 2008 at 7:28am | IP Logged Quote Anton

Please tell what version of ISAPI_Rewrite are you using.
And please send to support@helicontech.com your complete config and rewrite log.


__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 688
Posted: 26 August 2008 at 8:42am | IP Logged Quote Vyacheslav

Hi Jacob.
Please try these rules:
Code:
RewriteBase /

RewriteCond %{HTTP_HOST} ^bransontourismcenter\.com [NC]
RewriteRule ^(.*)$ http://www.bransontourismcenter.com/$1 [R=301,L]

RewriteRule ^index\.(?:htm|php)$ index.html [R=301,L]

RewriteRule ^upcomingbransonevents\.htm$ http://www.bransontourismcenter.com/events/ [R=301]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? $1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?!index)(\w+)\.html?$ $1.php [NC,L]


__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
jacob santos
Newbie
Newbie


Joined: 21 August 2008
Location: United States
Online Status: Offline
Posts: 3
Posted: 26 August 2008 at 1:49pm | IP Logged Quote jacob santos

Last rule didn't fix the issue.

I should add that I am using Plesk, but have removed urlprotect from the domain.
Back to Top View jacob santos's Profile Search for other posts by jacob santos
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 688
Posted: 27 August 2008 at 5:11am | IP Logged Quote Vyacheslav

Please provide your rewrite.log using my rules. Also please tell your version of ISAPI_Rewrite.

You can send all information with confidential data to support@helicontech.com

__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 688
Posted: 27 August 2008 at 5:36am | IP Logged Quote Vyacheslav

Jacob, I have received your letter and have answered on it. Please check your email.

__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum