This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions (Forum Locked Forum Locked)
 Helicon Tech : Common Questions
Subject Topic: how to prevent request page without param
Author
Message |
toologic
Newbie


Joined: 12 September 2008
Location: Russian Federation
Posts: 15
Posted: 01 December 2011 at 4:27am

Hello!

I have a page that should be called only with parameters. For example:

instead of page.aspx must call page.aspx?id=0

How i can do it?

p.s. isapi_rewrite 3.0

Back to Top Visit toologic's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 01 December 2011 at 11:06am

So, do you want to add a parameter when it's absent or do you want to block pages without parameters?

Please try

RewriteBase /
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^page\.aspx$ /page.aspx\?id=0 [NC,L]

__________________
Regards,
Anton
Back to Top
 
toologic
Newbie


Joined: 12 September 2008
Location: Russian Federation
Posts: 15
Posted: 01 December 2011 at 12:01pm

Anton, thanks

I want to add a parameter when it's absent.

And and another question. How can I limit call the page with only a specific range of IP, and all other redirect to another page, for example 403.aspx  - access denied?

Back to Top Visit toologic's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 02 December 2011 at 4:54am

To add the query sting please try the code I've given above:

RewriteBase /
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^page\.aspx$ /page.aspx\?id=0 [NC,L]

As for IP ranges, try this structure (it may require a tricky regular expression to specify the range but it's achievable):

RewriteCond %{REMOTE_ADDR} !^203\.20\.15\.10$
RewriteRule .? /403.aspx [R=301,L]

__________________
Regards,
Anton
Back to Top
 

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

Printable version Printable version
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