httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Fleet" <afl...@digerati.com.au>
Subject RE: [users@httpd] Rewriting to a servlet
Date Mon, 16 Feb 2004 04:31:29 GMT
Thanks to Owen, who asked "Does the servlet work without a query string?",
and yes, it should at least display something, but unfortunately doesn't.

In a nutshell, I want

http://payment.digerati.com.au/test/paymentengine.page.Welcome

to be rewritten to

http://payment.digerati.com.au/pay/servlet/paymentengine.page.Welcome

and the log file looks like the rewriting is taking effect, yet the servlet
is not loading. I think it may have something to do with the order of the
modules loaded in httpd.conf, and have played around, but no luck.

Cannot anyone help me here?

Thanks in advance,

Adam.



-----Original Message-----
From: Boyle Owen [mailto:Owen.Boyle@swx.com]
Sent: 11 February 2004 8:15 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Rewriting to a servlet


> -----Original Message-----
> From: Adam Fleet [mailto:afleet@digerati.com.au]
> Sent: Mittwoch, 11. Februar 2004 06:48
> To: users@httpd.apache.org
> Subject: [users@httpd] Rewriting to a servlet
>
>
> Hi folks,
>
> we're running Apache on a Cobalt machine, which serves servlets using
> Tomcat.
>
> We have a servlet
>
>
http://payment.digerati.com.au/pay/servlet/paymentengine.page.Welcome?si
teId=1
>
> which runs fine. I would like to set up a rewrite rule so
> that the following
> URL is rewritten to the URL above.
>
>
http://payment.digerati.com.au/test/paymentengine.page.Welcome?siteId=1
>
> An excerpt from my httpd.conf follows (note the last rule):
>
> RewriteEngine On
> RewriteLog /home/digerati/logs/rewrite_log
> RewriteLogLevel 6
> RewriteCond %{HTTP_HOST}                ^([^:]+)
> RewriteCond %{DOCUMENT_ROOT}            !-d
> RewriteRule .*
http://%1:444/error/forbidden.html [L,R]
> RewriteCond %{HTTP_HOST}                ^([^:]+)
> RewriteRule ^/admin/?$                  http://%1:444/login.php [L,R]
> RewriteCond %{HTTP_HOST}                ^([^:]+)
> RewriteRule ^/siteadmin/?$              http://%1:444/login.php [L,R]
> RewriteCond %{HTTP_HOST}                ^([^:]+)
> RewriteRule ^/personal/?$               http://%1:444/login.php [L,R]
> RewriteCond %{HTTP_HOST}                ^([^:]+)
> RewriteRule ^/login/?$                  http://%1:444/login.php [L,R]
>
> RewriteRule ^/test/(paymentengine\..*)$ /pay/servlet/$1 [PT]
>
> Looking at the log file, it seems to try to perform the
> rewrite ok, yet I
> still end up with "this page cannot be found"

Will the servlet work if there is no query string? (ie, does
http://payment.digerati.com.au/test/paymentengine.page.Welcome work? -
it gives me a 404).

The bit after the "?" is the query string and is not part of the pattern
passed to mod_rewrite. If you want to pass on the query string, you have
to add it manually, eg

RewriteRule ^/test/(paymentengine\..*)$ /pay/servlet/$1?%{QUERY_STRING}
[PT]

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored.


>
> Here's the rewrite_log excerpt:
>
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (2) init rewrite
> engine with requested uri /test/paymentengine.page.Welcome
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (3) applying
> pattern '^/(.*)' to uri '/test/paymentengine.page.Welcome'
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (4) RewriteCond:
> input='payment.digerati.com.au'
> pattern='!^202.62.62.6(:80)?$' => matched
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (4) RewriteCond:
> input='payment.digerati.com.au'
> pattern='!^payment.digerati.com.au(:80)?$'
> => not-matched
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (3) applying
> pattern '.*' to uri '/test/paymentengine.page.Welcome'
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (4) RewriteCond:
> input='payment.digerati.com.au' pattern='^([^:]+)' => matched
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (4) RewriteCond:
> input='/home/.sites/112/site7/web' pattern='!-d' => not-matched
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (3) applying
> pattern '^/admin/?$' to uri '/test/paymentengine.page.Welcome'
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (3) applying
> pattern '^/siteadmin/?$' to uri '/test/paymentengine.page.Welcome'
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (3) applying
> pattern '^/personal/?$' to uri '/test/paymentengine.page.Welcome'
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (3) applying
> pattern '^/login/?$' to uri '/test/paymentengine.page.Welcome'
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial]
> (3) applying
> pattern '^/test/(paymentengine\..*)$' to uri
> '/test/paymentengine.page.Welcome'
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial] (2) rewrite
> /test/paymentengine.page.Welcome ->
> /pay/servlet/paymentengine.page.Welcome
> 203.55.204.4 - - [11/Feb/2004:16:45:14 +1100]
> [payment.digerati.com.au/sid#843bd1c][rid#84562a4/initial] (2) forcing
> '/pay/servlet/paymentengine.page.Welcome' to get passed
> through to next API
> URI-to-filename handler
>
> Can anyone point me in the right direction?
>
> Cheers,
>
> Adam Fleet.
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Diese E-mail ist eine private und persönliche Kommunikation. Sie hat
keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This
e-mail is of a private and personal nature. It is not related to the
exchange or business activities of the SWX Group. Le présent e-mail est
un message privé et personnel, sans rapport avec l'activité boursière du
Groupe SWX.

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender's company.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message