Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x support forum
 Helicon Tech : ISAPI_Rewrite 2.x support forum
Subject Topic: Need help writting a rule to deny access Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
deepakrajr
Newbie
Newbie


Joined: 07 August 2007
Online Status: Offline
Posts: 19
Posted: 11 July 2008 at 5:37am | IP Logged Quote deepakrajr

Hi,

i hope some one can help, I'm trying to deny access to my static pages when additional slashes are added to my .htm file extension. what I'm seeing happening is a request comes like this:

www.example.com/directory/index.htm/additionalwords
or like this
www.example.com/directory/index.htm/

my server is giving a 200 header on any of the above requests.

i'd like to deny access to anything thats appended after the .htm (apart from bookmarks of course)

can any one help me please.

Regards
Deepak


Back to Top View deepakrajr's Profile Search for other posts by deepakrajr
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7598
Posted: 12 July 2008 at 12:41pm | IP Logged Quote Lexey

Quote:
i'd like to deny access to anything thats appended after the .htm (apart from bookmarks of course)


What do you mean by bookmarks here?

Try the following rule:

RewriteRule [^?]+\.htm/.* $0 [I,F]
Back to Top View Lexey's Profile Search for other posts by Lexey
 
deepakrajr
Newbie
Newbie


Joined: 07 August 2007
Online Status: Offline
Posts: 19
Posted: 14 July 2008 at 10:09pm | IP Logged Quote deepakrajr

Hi Lexey,

Thanks for the reply, unfortunately i'm not getting the results i'd like with the above rule, i've played around with a few different ways and i've manged to get this rule to block everything except ?=source

RewriteCond Host: (?:www\.abcl\.com.*)
RewriteCond URL .*\.htm [O]
RewriteRule ([^?]*\.htm)\?(?!source=).* http\://www.abcl.com/error/404_test.asp [U,CL,L]

but this isn't exactly what i want as you can see this is allowing the ?source how do i get the above rule to work for .htm/

regarding bookmarks by this i mean

www.abc.com/directory/index.htm/#top

Thanks for your help.

regards
Deepak.




Back to Top View deepakrajr's Profile Search for other posts by deepakrajr
 
deepakrajr
Newbie
Newbie


Joined: 07 August 2007
Online Status: Offline
Posts: 19
Posted: 14 July 2008 at 10:10pm | IP Logged Quote deepakrajr

Sorry the bookmark should be like this

www.abc.com/directory/index.htm#top

i've got /'s on the brain ;)

hope you can guide me in the right direction.

Deepak
 
Back to Top View deepakrajr's Profile Search for other posts by deepakrajr
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7598
Posted: 28 July 2008 at 5:24pm | IP Logged Quote Lexey

Rule I have given to you was written according to your requirements. If it does not work then the requirements are wrong. Decribe the correct requirements first.
And you could forget about bookmarks since a server never sees them.
Back to Top View Lexey's Profile Search for other posts by Lexey
 
deepakrajr
Newbie
Newbie


Joined: 07 August 2007
Online Status: Offline
Posts: 19
Posted: 29 July 2008 at 7:09am | IP Logged Quote deepakrajr

Hi Lexey,

Thanks for the reply, ok some months ago we noticed search engine indexing our URL’s with additional queries added to the end.

An example of this would be www.example.com/directory/index.htm?we_sent_you_traffic  

At the time we needed some of these URL’s to be allowed due to advertising on an external site so this rule was implemented as below:

RewriteCond Host: (?:www\.abcl\.com.*)
RewriteCond URL .*\.htm [O]
RewriteRule ([^?]*\.htm)\?(?!source=).* http\://www.abcl.com/error/404_test.asp [U,CL,L]

Which disallowed everything that we thought wasn’t necessary, now we are seeing search engines indexing URL’s which slipped passed the above rule.

As we are no longer needing the above rule to allow ?source=    I’d like to be able to stop all traffic that’s coming in to .htm file that has any character added after the first.htm file extension, I say this because I’ve also seen my server giving access to URL’s that contain two separate .htm in a single URL.

When adding this to the file it didn’t deny access to URLs that had / added to the .htm file.

RewriteCond Host: (?:www\.abcl\.com.*)
RewriteCond URL .*\.htm [O]
RewriteRule [^?]+\.htm/.* $0 [I,F]

If you could explain where I’m going wrong or give me another example that will deny access to any thing requesting additional characters to .htm files I would greatly appreciate it.

Regards,
Deepak



Back to Top View deepakrajr's Profile Search for other posts by deepakrajr
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7598
Posted: 31 July 2008 at 3:32pm | IP Logged Quote Lexey

Quote:
When adding this to the file it didn’t deny access to URLs that had / added to the .htm file.


That rule will not work because the condition
RewriteCond URL .*\.htm [O] will not be satisfied.
Try this rule instead:

RewriteCond Host: (?:www\.abcl\.com.*)
RewriteRule [^?]+?\.htm[/?].* $0 [I,F]
Back to Top View Lexey's Profile Search for other posts by Lexey
 

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 cannot vote in polls in this forum