This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: checking file exists based on url values?
Author
Message |
erikv
Newbie


Joined: 02 July 2007
Posts: 14
Posted: 05 November 2011 at 4:26am

If I have a url to be rewritten like so:

mysite.com/foo/bar/

I'd like to check if /cache/foobar.html exists on the server, and run different rewrites based on if that file does or does not exist.

So I think I'll need a rewritecond to check for that url pattern, then a second rewritecond to check if the file exists.  Right? 

Could anyone please help with those two RewriteCond statements?

If it matters, I'm using v3.1.0.62 (registered)

Thanks!
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 07 November 2011 at 8:55am

Hello,

Here're the following conditions:

Check if the folder and file EXIST:
Code:
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d


Check if the folder and file DO NOT EXIST:
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


in case you want either file or directory to be checked, use [OR] flag.

Regards
Andrew
Back to Top
 
erikv
Newbie


Joined: 02 July 2007
Posts: 14
Posted: 07 November 2011 at 4:16pm

Thanks, that's the basic rule I've been using, along with the [NC] flag.

REQUEST_FILENAME didn't work on my dev environment (iis 6, win2008), so I had to use  PATH_TRANSLATED.

Neither works on my production environment (iis 6, win2003),  so I'm trying to find something that will.

Any ideas why I'm having trouble?




Edited by erikv - 07 November 2011 at 4:26pm
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 08 November 2011 at 4:26am

Oh, I believe it's your old build.
Try to uninstall old version and install a new one. (Do not update, there're over 20 builds in between)

Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version