httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Pasher <just...@newmediagateway.com>
Subject Re: [users@httpd] java app URL rewrite
Date Thu, 18 Sep 2008 20:03:59 GMT
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


Mime
View raw message