Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_write and query string

Status
Not open for further replies.

camiloas

Technical User
Jan 19, 2007
2
ES
Hi!
I'm trying to use mod_rewrite to limit servlet access.

I'd would like to redirect all query string attempts to a disconnect option.

--->
Finally the Servlet request will by processed by the application server, so [PT] is required.


Below you can see my code



RewriteLog /tmp/rewrite.log
RewriteLogLevel 3
RewriteCond %{QUERY_STRING} request=[a-zA-Z]+
RewriteRule /test/Servlet?request=[a-zA-Z]+ /test/Servlet?request=disconnect [PT]


But does't work properly. Can I make a filter based on query string?


Thanks in Advance
 
Hi

I do not see any reason to use [tt]PT[/tt]. Is the rewriting enabled ?
Code:
RewriteEngine on
[gray]# then your code follows...[/gray]
camiloas said:
But does't work properly.
Please give us more details. Does nothing ? Wrong result ? Error message ?
camiloas said:
Can I make a filter based on query string?
Yes, you can use check the QUERY_STRING environment variable in a [tt]RewriteCond[/tt] directive, if this was the question.

Feherke.
 
Hi Feherke,
Thank you for tour answer.
Yes, RewriteEngine is on.

I think that PT is mandatory because my Apache has the WebSphere Plugin and the Servlet is proccesed by it.

When I test my code seems that mod_rewrite doesn't detects the "?request=XXXX" (query part) in the original request. So, The filter is not applied.

Thank in advance.
Best Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top