httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Pasher <>
Subject Re: [users@httpd] java app URL rewrite
Date Thu, 18 Sep 2008 17:52:32 GMT
Stauffer, Robert G wrote:
> Justin,
> Just tried:
> <VirtualHost>
>   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:
> - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) init rewrite engine
> with requested uri /
> - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (3) applying pattern '^/$'
> to uri '/'
> - - [18/Sep/2008:13:28:17 --0400]
> [portal-dev/sid#8122b18][rid#81c5c40/initial] (2) rewrite / ->
> /jahia/Jahia/site/jazzd/pid/9
> - - [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
> - - [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:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message