You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Stauffer, Robert G" <rs...@decommunications.com> on 2008/09/18 17:56:05 UTC

[users@httpd] java app URL rewrite

Hi all,

OK, I'm stummped.  I'm new to URL rewriting and I have one I struggling
with.  I've messed with it for a few days, but can't seem to get very
far.

Environment:
Web server: IBM HTTP Server 6.0.2.23 - based on Apache 2.0.47
App server: IBM WebSphere App Server 6.0.2.23
Java app: Jahia Content Management System 5.0.3
OS: RHEL ES4

App server info:
Servlet name: Jahia
Context root: /jahia
Servlet path: /Jahia

All URL's are in the form
http://<hostname>:<port>/jahia/Jahia/site/jazzd/pid/<page id>

Home page: http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9

The task: strip out jahia/Jahia from all URL's.

Example:
Rewrite http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9 to
http://portal-dev:81/site/jazzd/pid/9, but display URL in the browser as
http://portal-dev:81/site/jazzd/pid/9.

I have the stuff below in the httpd.conf.  It serves up the correct
page, but the browser URL is http://portal-dev:81/ instead of
http://portal-dev:81/site/jazzd/pid/9.

<VirtualHost portal-dev.dande.com:81>
  RewriteEngine On
  RewriteLogLevel 3
  RewriteLog logs/rewrite_port81.log
  RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [C,PT]    (This
redirects properly, but the next line is ignored.)
  RewriteRule ^jahia/Jahia/(.+)$ $1 [L]
</VirtualHost>

logs/rewrite_port81.log: 
10.208.4.137 - - [18/Sep/2008:11:54:17 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (2) init rewrite engine
with requested uri /
10.208.4.137 - - [18/Sep/2008:11:54:17 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (3) applying pattern '^/$'
to uri '/'
10.208.4.137 - - [18/Sep/2008:11:54:17 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (2) rewrite / ->
/jahia/Jahia/site/jazzd/pid/9
10.208.4.137 - - [18/Sep/2008:11:54:17 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (2) forcing
'/jahia/Jahia/site/jazzd/pid/9' to get passed through to next API
URI-to-filename handler
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (2) init rewrite engine
with requested uri /jazzdassets/scripts/tabber.js
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (3) applying pattern '^/$'
to uri '/jazzdassets/scripts/tabber.js'
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (3) applying pattern
'^jahia/Jahia/(.+)$' to uri '/jazzdassets/scripts/tabber.js'
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c5400/initial] (1) pass through
/jazzdassets/scripts/tabber.js
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c9410/initial] (2) init rewrite engine
with requested uri /jazzdassets/css/tabber.css
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c9410/initial] (3) applying pattern '^/$'
to uri '/jazzdassets/css/tabber.css'
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c9410/initial] (3) applying pattern
'^jahia/Jahia/(.+)$' to uri '/jazzdassets/css/tabber.css'
10.208.4.137 - - [18/Sep/2008:11:54:18 --0400]
[portal-dev/sid#8122b18][rid#81c9410/initial] (1) pass through
/jazzdassets/css/tabber.css
...

I've tried various permutations of RewriteRule, but I can't seem to find
the right one.  Any thoughts on how to do this?




Bob Stauffer
DBA
D&E Communications
Ephrata, PA
rstauffer@decommunications.com
717-738-8737 

**DISCLAIMER
This e-mail message and any files transmitted with it are intended for the use of the individual or entity to which they are addressed and may contain information that is privileged, proprietary and confidential. If you are not the intended recipient, you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received this communication in error, please notify the sender and delete this e-mail message. The contents do not represent the opinion of D&E except to the extent that it relates to their official business.

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


Re: [users@httpd] java app URL rewrite

Posted by André Warnier <aw...@ice-sa.com>.
Stauffer, Robert G wrote:
[...]

> 
> <VirtualHost portal-dev.dande.com:81>
>   RewriteEngine On
>   RewriteLogLevel 3
>   RewriteLog logs/rewrite_port81.log
>   RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [C,PT]    (This
> redirects properly, but the next line is ignored.)

I'm not (yet) an expert, but isn't your problem the [,PT] flag above ? 
Does that flag not imply "stop rewriting here and proxy now" ?
What if you move the PT flag to the next rule, like :

>   RewriteRule ^/jahia/Jahia/(.+)$ /$1 [L,PT]
> </VirtualHost>
> 
(and also add slashes as I added them above)
(I'm not really sure of that one though, but I think)



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


Re: [users@httpd] java app URL rewrite

Posted by Eric Covener <co...@gmail.com>.
On Thu, Sep 18, 2008 at 6:26 PM, Eric Covener <co...@gmail.com> wrote:
> Subsequent rules don't run after the L or PT flags, when your rules
> are in httpd.conf outside of directory/location.

Whoops, credited Andre's observation here in the first draft and lost it.

-- 
Eric Covener
covener@gmail.com

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


Re: [users@httpd] java app URL rewrite

Posted by Eric Covener <co...@gmail.com>.
On Thu, Sep 18, 2008 at 3:22 PM, Stauffer, Robert G
<rs...@decommunications.com> wrote:
> OK, that makes sense that PT wouldn't apply and that the rewrite engine
> won't reprocess the URL.
>
> Hmmmmmmm.  I did a poor job of explaining what I'm trying to do.
> Basically I'm trying to hide the "jahia/Jahia" portion of the URL.  That
> means there are three cases that need to be handled:


Your still not describing it rigorously enough, as solprovider explains.

You need to explicitly decide when you want to send a redirect
(changing the URL in a response to the browser) vs. when you want to
fixup a URL silently (IOTW rewriting it).  You need to craft these
rules so they don't step on eachothers toes (by virtue of their
ordering and the URL-space they operate on.

Note that if your requests ultimately go through the websphere plugin,
you must ultimately have the PT flag (and your substitution must be a
URI not a filesystem path) but as Andre mentions you must be dilligent
re: which point you use PT to copy the filename back to the URI.

Subsequent rules don't run after the L or PT flags, when your rules
are in httpd.conf outside of directory/location.


-- 
Eric Covener
covener@gmail.com

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


Re: [users@httpd] java app URL rewrite

Posted by Justin Pasher <ju...@newmediagateway.com>.
Stauffer, Robert G wrote:
> OK, that makes sense that PT wouldn't apply and that the rewrite engine
> won't reprocess the URL.
>
> Hmmmmmmm.  I did a poor job of explaining what I'm trying to do.
> Basically I'm trying to hide the "jahia/Jahia" portion of the URL.  That
> means there are three cases that need to be handled:
>
> 1) If the incoming URL is http://portal-dev:81/, it needs to be directed
> to the home page which is
> http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9.  But the outgoing URL
> displayed in the user's browser needs to be
> http://portal-dev:81/site/jazzd/pid/9.
> Or
> 2) If the incoming URL is something like
> http://portal-dev:81/jahia/Jahia/site/jazzd/pid/31, it needs to be
> directed to http://portal-dev:81/jahia/Jahia/site/jazzd/pid/31.  But the
> outgoing URL display in the user's browser needs to be
> http://portal-dev:81/site/jazzd/pid/31.
> Or
> 3) If the incoming URL is something like
> http://portal-dev:81/site/jazzd/pid/17, it needs to be directed to
> http://portal-dev:81/jahia/Jahia/site/jazzd/pid/17.  But the outgoing
> URL display in the user's browser needs to be
> http://portal-dev:81/site/jazzd/pid/17.
>
>
> Just sticking to case 1) for now, the following redirects
> http://portal-dev:81/ to
> http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9.  But the outgoing URL
> displayed in the user's browser is
> http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9, not
> http://portal-dev:81/site/jazzd/pid/9.  How do I modify the following to
> redirect to the right place and not show "jahia/Jahia" portion in the
> users browser?
>
> <VirtualHost portal-dev.dande.com:81>
>   RewriteEngine On
>   RewriteLogLevel 3
>   RewriteLog logs/rewrite_port81.log
>   RewriteRule ^/$ jahia/Jahia/site/jazzd/pid/9 [R,L]
> </VirtualHost>
>   

Ahhh, I see now. Much clearer. You're looking for something like this.

RewriteRule ^/jahia/Jahia/(.*)$ /$1 [R,L]
RewriteRule ^/site/jazzd/(.*)$ /jahia/Jahia/site/jazzd/$1 [L]
RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [L]


The first rule performs the forced redirect to get "/jahia/Jahia" out of 
the URL.
The second rule performs the internal rewrite to make it match the real 
page you want to load.
The third rule catches the request to the root directory.

You might need/want to tweak the second rule on how much of the URL it 
matches for the rewrite, since I don't know whether things under "/site" 
that are not under "/site/jazzd" should be redirected.

--
Justin Pasher

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


RE: [users@httpd] java app URL rewrite

Posted by "Stauffer, Robert G" <rs...@decommunications.com>.
OK, that makes sense that PT wouldn't apply and that the rewrite engine
won't reprocess the URL.

Hmmmmmmm.  I did a poor job of explaining what I'm trying to do.
Basically I'm trying to hide the "jahia/Jahia" portion of the URL.  That
means there are three cases that need to be handled:

1) If the incoming URL is http://portal-dev:81/, it needs to be directed
to the home page which is
http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9.  But the outgoing URL
displayed in the user's browser needs to be
http://portal-dev:81/site/jazzd/pid/9.
Or
2) If the incoming URL is something like
http://portal-dev:81/jahia/Jahia/site/jazzd/pid/31, it needs to be
directed to http://portal-dev:81/jahia/Jahia/site/jazzd/pid/31.  But the
outgoing URL display in the user's browser needs to be
http://portal-dev:81/site/jazzd/pid/31.
Or
3) If the incoming URL is something like
http://portal-dev:81/site/jazzd/pid/17, it needs to be directed to
http://portal-dev:81/jahia/Jahia/site/jazzd/pid/17.  But the outgoing
URL display in the user's browser needs to be
http://portal-dev:81/site/jazzd/pid/17.


Just sticking to case 1) for now, the following redirects
http://portal-dev:81/ to
http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9.  But the outgoing URL
displayed in the user's browser is
http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9, not
http://portal-dev:81/site/jazzd/pid/9.  How do I modify the following to
redirect to the right place and not show "jahia/Jahia" portion in the
users browser?

<VirtualHost portal-dev.dande.com:81>
  RewriteEngine On
  RewriteLogLevel 3
  RewriteLog logs/rewrite_port81.log
  RewriteRule ^/$ jahia/Jahia/site/jazzd/pid/9 [R,L]
</VirtualHost>




Bob Stauffer
DBA
D&E Communications
Ephrata, PA
rstauffer@decommunications.com
717-738-8737 
-----Original Message-----
From: Justin Pasher [mailto:justinp@newmediagateway.com] 
Sent: Thursday, September 18, 2008 13:53
To: users@httpd.apache.org
Subject: Re: [users@httpd] java app URL rewrite

Stauffer, Robert G wrote:
> Justin,
>
> Just tried:
> <VirtualHost portal-dev.dande.com:81>
>   RewriteEngine On
>   RewriteLogLevel 3
>   RewriteLog logs/rewrite_port81.log
>   RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [C,PT]
>   RewriteRule ^/jahia/Jahia/(.+)$ $1 [L]
> </VirtualHost>
>
> Same thing happened: It serves up the correct page, but the browser
URL
> is http://portal-dev:81/ instead of
> http://portal-dev:81/site/jazzd/pid/9.  And the second RewriteRule is
> ignored:
>
> logs/rewrite_port81.log:
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) init rewrite engine
> with requested uri /
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (3) applying pattern
'^/$'
> to uri '/'
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) rewrite / ->
> /jahia/Jahia/site/jazzd/pid/9
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) forcing
> '/jahia/Jahia/site/jazzd/pid/9' to get passed through to next API
> URI-to-filename handler
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81f7c18/initial] (2) init rewrite engine
> with requested uri /jazzdassets/scripts/tabber.js
> ...
>
> Anyone know if there's a way to force the redirect to the first
> RewriteRule output and display the output of the second RewriteRule?
>   

I don't think the [PT] flag will actually apply to RewriteRule 
directives (the documentation isn't 100% clear on the subject, but it 
says "... hack to enable post-processing of the output of |RewriteRule| 
directives, using |Alias|, |ScriptAlias|, |Redirect|, and other 
directives from various URI-to-filename translators"). I would think it 
would specifically mention RewriteRule in the list if that applied.

You may be getting hit by the way rewrite rules are applied. I think 
when the RewriteRules are inside the apache config as opposed to and 
.htaccess file, the rules are not "reprocessed" for a single request 
after matching a rewrite rule. This means it matches the first request, 
then doesn't attempts to reprocess the URL through additional 
RewriteRules. It seems like you could simplify the rule and avoid the 
chain altogether by just doing this:

RewriteRule ^/$ /site/jazzd/pid/9 [L]

If you go directly to "http://portal-dev:81/jahia/Jahia/something", are 
you redirected to "http://portal-dev:81/something"? Since you are not 
setting a RewriteBase, you might need to tell mod_rewrite to anchor it 
to the beginning of the URL, like this:

RewriteRule ^/jahia/Jahia/(.+)$ /$1 [L]

To simplify things, I would first work on getting this rule to work by 
itself (which seems like it should with the change above). Then 
additional rules can be added.

-- 
Justin Pasher

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


**DISCLAIMER
This e-mail message and any files transmitted with it are intended for the use of the individual or entity to which they are addressed and may contain information that is privileged, proprietary and confidential. If you are not the intended recipient, you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received this communication in error, please notify the sender and delete this e-mail message. The contents do not represent the opinion of D&E except to the extent that it relates to their official business.

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


Re: [users@httpd] java app URL rewrite

Posted by Justin Pasher <ju...@newmediagateway.com>.
Stauffer, Robert G wrote:
> Justin,
>
> Just tried:
> <VirtualHost portal-dev.dande.com:81>
>   RewriteEngine On
>   RewriteLogLevel 3
>   RewriteLog logs/rewrite_port81.log
>   RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [C,PT]
>   RewriteRule ^/jahia/Jahia/(.+)$ $1 [L]
> </VirtualHost>
>
> Same thing happened: It serves up the correct page, but the browser URL
> is http://portal-dev:81/ instead of
> http://portal-dev:81/site/jazzd/pid/9.  And the second RewriteRule is
> ignored:
>
> logs/rewrite_port81.log:
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) init rewrite engine
> with requested uri /
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (3) applying pattern '^/$'
> to uri '/'
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) rewrite / ->
> /jahia/Jahia/site/jazzd/pid/9
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) forcing
> '/jahia/Jahia/site/jazzd/pid/9' to get passed through to next API
> URI-to-filename handler
> 10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81f7c18/initial] (2) init rewrite engine
> with requested uri /jazzdassets/scripts/tabber.js
> ...
>
> Anyone know if there's a way to force the redirect to the first
> RewriteRule output and display the output of the second RewriteRule?
>   

I don't think the [PT] flag will actually apply to RewriteRule 
directives (the documentation isn't 100% clear on the subject, but it 
says "... hack to enable post-processing of the output of |RewriteRule| 
directives, using |Alias|, |ScriptAlias|, |Redirect|, and other 
directives from various URI-to-filename translators"). I would think it 
would specifically mention RewriteRule in the list if that applied.

You may be getting hit by the way rewrite rules are applied. I think 
when the RewriteRules are inside the apache config as opposed to and 
.htaccess file, the rules are not "reprocessed" for a single request 
after matching a rewrite rule. This means it matches the first request, 
then doesn't attempts to reprocess the URL through additional 
RewriteRules. It seems like you could simplify the rule and avoid the 
chain altogether by just doing this:

RewriteRule ^/$ /site/jazzd/pid/9 [L]

If you go directly to "http://portal-dev:81/jahia/Jahia/something", are 
you redirected to "http://portal-dev:81/something"? Since you are not 
setting a RewriteBase, you might need to tell mod_rewrite to anchor it 
to the beginning of the URL, like this:

RewriteRule ^/jahia/Jahia/(.+)$ /$1 [L]

To simplify things, I would first work on getting this rule to work by 
itself (which seems like it should with the change above). Then 
additional rules can be added.

-- 
Justin Pasher

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


Re: [users@httpd] java app URL rewrite

Posted by so...@apache.org.
On 9/18/08, Stauffer, Robert G <rs...@decommunications.com> wrote:
> Same thing happened: It serves up the correct page, but the browser URL
> is http://example.com/ instead of
> http://example.com/site/jazzd/pid/9.  And the second RewriteRule is
>  ignored:
>  Bob Stauffer

You may be confusing several different processes.
1. The browser sends a request.  If the URL for http://example.com/
should redirect to http://example.com/site/jazzd/pid/9, then you need
a redirect.  Only a redirect will change the browser's URL.
2. The server responds to a request.  If
http://example.com/site/jazzd/pid/9 should be served by
http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9, then a RewriteRule
should add the "jahia/Jahia/".  RewriteRules do not affect the
browser, only how the server processes the request.
3. The page is sent to the browser.  Links on the page may include the
"jahia/Jahia/".  People following the links will see the
"jahia/Jahia/".  Fixing the links requires either changing the
application that created the page (often by configuring the root URL)
or using mod_proxy_html.  Rewriting links is obviously critical
functionality still not included in Apache httpd.  (My first Web
application included this functionality.)

Rewrite_Rules do not change browsers' URLs.  You need to use the
correct technology to create your solution.

solprovider

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


RE: [users@httpd] java app URL rewrite

Posted by "Stauffer, Robert G" <rs...@decommunications.com>.
Justin,

Just tried:
<VirtualHost portal-dev.dande.com:81>
  RewriteEngine On
  RewriteLogLevel 3
  RewriteLog logs/rewrite_port81.log
  RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [C,PT]
  RewriteRule ^/jahia/Jahia/(.+)$ $1 [L]
</VirtualHost>

Same thing happened: It serves up the correct page, but the browser URL
is http://portal-dev:81/ instead of
http://portal-dev:81/site/jazzd/pid/9.  And the second RewriteRule is
ignored:

logs/rewrite_port81.log:
10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
[portal-dev/sid#8122b18][rid#81c5c40/initial] (2) init rewrite engine
with requested uri /
10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
[portal-dev/sid#8122b18][rid#81c5c40/initial] (3) applying pattern '^/$'
to uri '/'
10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
[portal-dev/sid#8122b18][rid#81c5c40/initial] (2) rewrite / ->
/jahia/Jahia/site/jazzd/pid/9
10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
[portal-dev/sid#8122b18][rid#81c5c40/initial] (2) forcing
'/jahia/Jahia/site/jazzd/pid/9' to get passed through to next API
URI-to-filename handler
10.208.4.137 - - [18/Sep/2008:13:28:17 --0400]
[portal-dev/sid#8122b18][rid#81f7c18/initial] (2) init rewrite engine
with requested uri /jazzdassets/scripts/tabber.js
...

Anyone know if there's a way to force the redirect to the first
RewriteRule output and display the output of the second RewriteRule?


Bob Stauffer
DBA
D&E Communications
Ephrata, PA
rstauffer@decommunications.com
717-738-8737 
-----Original Message-----
From: Justin Pasher [mailto:justinp@newmediagateway.com] 
Sent: Thursday, September 18, 2008 12:14
To: users@httpd.apache.org
Subject: Re: [users@httpd] java app URL rewrite

Stauffer, Robert G wrote:
> Hi all,
>
> OK, I'm stummped.  I'm new to URL rewriting and I have one I
struggling
> with.  I've messed with it for a few days, but can't seem to get very
> far.
>
> Environment:
> Web server: IBM HTTP Server 6.0.2.23 - based on Apache 2.0.47
> App server: IBM WebSphere App Server 6.0.2.23
> Java app: Jahia Content Management System 5.0.3
> OS: RHEL ES4
>
> App server info:
> Servlet name: Jahia
> Context root: /jahia
> Servlet path: /Jahia
>
> All URL's are in the form
> http://<hostname>:<port>/jahia/Jahia/site/jazzd/pid/<page id>
>
> Home page: http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9
>
> The task: strip out jahia/Jahia from all URL's.
>
> Example:
> Rewrite http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9 to
> http://portal-dev:81/site/jazzd/pid/9, but display URL in the browser
as
> http://portal-dev:81/site/jazzd/pid/9.
>
> I have the stuff below in the httpd.conf.  It serves up the correct
> page, but the browser URL is http://portal-dev:81/ instead of
> http://portal-dev:81/site/jazzd/pid/9.
>
> <VirtualHost portal-dev.dande.com:81>
>   RewriteEngine On
>   RewriteLogLevel 3
>   RewriteLog logs/rewrite_port81.log
>   RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [C,PT]    (This
> redirects properly, but the next line is ignored.)
>   RewriteRule ^jahia/Jahia/(.+)$ $1 [L]
> </VirtualHost>

Have you tried using this?

RewriteRule ^/jahia/Jahia/(.+)$ $1 [L]

Notice the slash at the beginning.

-- 
Justin Pasher

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


**DISCLAIMER
This e-mail message and any files transmitted with it are intended for the use of the individual or entity to which they are addressed and may contain information that is privileged, proprietary and confidential. If you are not the intended recipient, you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received this communication in error, please notify the sender and delete this e-mail message. The contents do not represent the opinion of D&E except to the extent that it relates to their official business.

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


Re: [users@httpd] java app URL rewrite

Posted by Justin Pasher <ju...@newmediagateway.com>.
Stauffer, Robert G wrote:
> Hi all,
>
> OK, I'm stummped.  I'm new to URL rewriting and I have one I struggling
> with.  I've messed with it for a few days, but can't seem to get very
> far.
>
> Environment:
> Web server: IBM HTTP Server 6.0.2.23 - based on Apache 2.0.47
> App server: IBM WebSphere App Server 6.0.2.23
> Java app: Jahia Content Management System 5.0.3
> OS: RHEL ES4
>
> App server info:
> Servlet name: Jahia
> Context root: /jahia
> Servlet path: /Jahia
>
> All URL's are in the form
> http://<hostname>:<port>/jahia/Jahia/site/jazzd/pid/<page id>
>
> Home page: http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9
>
> The task: strip out jahia/Jahia from all URL's.
>
> Example:
> Rewrite http://portal-dev:81/jahia/Jahia/site/jazzd/pid/9 to
> http://portal-dev:81/site/jazzd/pid/9, but display URL in the browser as
> http://portal-dev:81/site/jazzd/pid/9.
>
> I have the stuff below in the httpd.conf.  It serves up the correct
> page, but the browser URL is http://portal-dev:81/ instead of
> http://portal-dev:81/site/jazzd/pid/9.
>
> <VirtualHost portal-dev.dande.com:81>
>   RewriteEngine On
>   RewriteLogLevel 3
>   RewriteLog logs/rewrite_port81.log
>   RewriteRule ^/$ /jahia/Jahia/site/jazzd/pid/9 [C,PT]    (This
> redirects properly, but the next line is ignored.)
>   RewriteRule ^jahia/Jahia/(.+)$ $1 [L]
> </VirtualHost>

Have you tried using this?

RewriteRule ^/jahia/Jahia/(.+)$ $1 [L]

Notice the slash at the beginning.

-- 
Justin Pasher

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